Awesome - thanks for sharing! Is there any chance you could contribute the relevant code as a patch to a Shiro Jira issue? This would be the easiest way to 1) keep track of adding this as a feature and 2) accepting a code contribution.
Regards, -- Les Hazlewood CTO, Katasoft | http://www.katasoft.com | 888.391.5282 twitter: @lhazlewood | http://twitter.com/lhazlewood katasoft blog: http://www.katasoft.com/blogs/lhazlewood personal blog: http://leshazlewood.com On Thu, Oct 6, 2011 at 12:21 AM, matan_a <[email protected]> wrote: > I got a version of this working and i thought i'd share what i have so far: > > http://www.box.net/shared/rgjvtrxvn66jv8a1478u > > Basically, it's another DAO implementation (set your sessionManager to use > this version). The RequestCacheSessionDAO caches the session in the > ThreadContext of the current request which is emptied out with everything > else at the end of the request. It greatly reduces the amount of times the > session is retrieved from the cache/backend storage. > > RequestCacheSessionDAO requires an implementation of > RequestCacheSessionStore which is the actual class that would do the > serialization and backend storage IO. > > I've included a MongoDB implementation of the Store and two > CacheSerializers. JavaCacheSerializer is a plain vanilla Java Serialization > implementation. KryoCacheSerializer uses Kryo (see > http://code.google.com/p/kryo/), which is quite a bit faster, but requires > you to register any special classes you dump in the session with the > KryoCacheSerializer. > > I apologize for the messy code and the Spring references. I just pulled it > out and removed any proprietary info. Feel free to use/abuse/keep/delete as > you see fit. > > Cheers. > > > -- > View this message in context: > http://shiro-user.582556.n2.nabble.com/Cache-called-too-many-times-per-request-tp6851915p6864830.html > Sent from the Shiro User mailing list archive at Nabble.com.
