简体   繁体   English

报告海边会议,例如到期时间

[英]Reporting on Seaside Sessions, such as time to expirey

How do I display a report showing all current seaside sessions along with their expected expiry time? 如何显示显示所有当前海边会话及其预期到期时间的报告?

self session application sessionsDo: [:each | 
html text: 'Session For ',((each properties values at: 1) username),' Expires At: '.
html render: (Time now addSeconds: (each application cache expiryPolicy timeout)).
html break].

This, however, shows the wrong results in that it shows that all sessions expire at the same time, which is 600 seconds from Time now. 但是,这显示了错误的结果,因为它显示所有会话同时到期,距现在时间600秒。 I can't find another way to get at 'time remaining'. 我找不到另一种方法来“剩余时间”。

WWLD? WWLD? (What would Lukas do)? (卢卡斯会做什么)?

KR Dusty KR Dusty

The following code should do it: 以下代码应该这样做:

WAApplication allInstances do: [ :application |
   application keysAndHandlersDo: [ :key :session |
      | policy table |
      policy := application cache expiryPolicy.
      table := policy instVarNamed: 'lastAccessTable'.
      Transcript 
        show: session; show: ' expires in '; 
        show: policy timeout - (Time totalSeconds - (table at: key));
        show: ' seconds'; cr ] ]

Note that the above code accesses internal data structures that might change in the future. 请注意,上述代码访问将来可能会更改的内部数据结构。 Also you might need to add additional checks to make it work with your setup. 此外,您可能需要添加其他检查以使其适用于您的设置。

Also note that you might get negative seconds. 另请注意,您可能会获得负秒数。 This means that the session is supposed to disappear, but it hasn't been reaped yet. 这意味着会话应该会消失,但还没有收到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM