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.

Reply via email to