Hi Ergin, With Memcached, I don't think this is possible - Memcache is purposefully 'dumb'. And if Shiro can't get access to the active session keys and/or entries are evicted without Shiro's knowledge, there is no way for Shiro to react accordingly.
Another data store is probably necessary for your requirement: you might consider Hazelcast - via its Loader/Store interfaces, it can persist data to disk, and so you can ensure that even if the data is evicted from memory (due to RAM constraints), data can still be 'paged in' later for access. TerraCotta+Ehcache is another potential solution (but I'm particularly smitten with Hazelcast at the moment - it just works). As Hazelcast is Apache 2.0 licensed, I've recently added Hazelcast as a Shiro plugin here: http://svn.apache.org/repos/asf/shiro/trunk/support/hazelcast/ It won't be released until Shiro 1.3, but at least you can copy it in the meantime if you wish. HTH, -- Les Hazlewood | @lhazlewood CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282 Stormpath wins GigaOM Structure Launchpad Award! http://bit.ly/MvZkMk On Mon, Jan 21, 2013 at 6:23 PM, agilone <[email protected]> wrote: > Hi All, We are using EnterpriseSessionDAO implementation with Memcached as > a > back store. Our problem is we are not able to keep track of sessions that > are expired because of inactivity. In terms of session storage system it > works fine, everything works as anticipated. I have digged into code and > realized that getActiveSessions() method returns null for cache > implementation since Cache client can't get all the active sessions [or > key's in memcached] from cache cluster. Therefore capturing orphan sessions > expiration statuses and then log them to reporting environment [MySQL] > seems > impossible. Would you please propose a solution where we can capture this > information? Thanks in advance,ErginHere is more details > EnterpriseCacheSessionDAO is our session backend with memcached > cachemanager implemented. Current cluster contains four machines. We > extended DefaultSessionManager to capture expired sessions afterStopped() > afterExpired() System logs session of the user first time when they login > and also during log out if they use log-out command. However we are not > able > to capture expiration events for other sessions [orphan sessions] in which > user left the session without log-out. This causes lots of orphan sessions > in my reporting environment which have start time and session id but no > stop time and expired information. > > > > -- > View this message in context: > http://shiro-user.582556.n2.nabble.com/EnterpriseCacheSessionDAO-Session-Expiry-and-Reporting-Session-State-tp7578194.html > Sent from the Shiro User mailing list archive at Nabble.com. >
