Hi Charles, This is a good question! No need to apologize :)
The cache name you've shown, "org.apache.shiro.realm.text.PropertiesRealm-0-accounts", looks like a cache name used for caching account data for authentication or authorization - not for sessions. (For authentication and authorization caching, Shiro uses an auto-generated cache name with an atomic number - 0, 1, 2 ,etc if you don't specify a cache name). However, because this name is auto-generated, it might make more sense to use a name that matches your realm. Shiro uses the realm name + two suffixes to distinguish between cache regions: realm.getName() + ".authenticationCache" = the name of the cache region that caches authentication data (for use during repeated login) and realm.getName() + ".authorizationCache" = the name of the cache region that caches authorization data (for use during repeated role or permission checks). Anyway, all of this has nothing to do with Sessions. When using Shiro's native sessions, if you want session clustering, you usually plug in an 'enterprise' cache manager capable of data clustering (e.g. like Terracotta + Ehcache, or GigaSpaces or Coherence or Hazelcast or Zookeeper, etc, etc). For storing sessions, you want to specify a cache region (i.e. cache 'name') just for sessions. Shiro defaults to assuming the cache region is named "shiro-activeSessionCache". An example Ehcache config is shown here: http://shiro.apache.org/session-management.html#SessionManagement-EHCacheSessionCacheConfiguration You'll also want to understand the SessionDAO concept and how to configure a SessionDAO that uses your cache. This is covered here: http://shiro.apache.org/session-management.html#SessionManagement-SessionStorage HTH! -- Les Hazlewood | @lhazlewood CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282 Stormpath wins GigaOM Structure Launchpad Award! http://bit.ly/MvZkMk On Thu, Aug 30, 2012 at 4:55 AM, Charles Syperski <[email protected]> wrote: > I am attempting to get shiro working with terracotta for session > replication. I think everything is setup and good to go with the exception > of my cache settings on the client side (ehcache.xml) for > 'org.apache.shiro.realm.text.PropertiesRealm-0-accounts' > > Here is my current config for this cache: > > <cache name="org.apache.shiro.realm.text.PropertiesRealm-0-accounts" > maxElementsInMemory="10000" > eternal="true" > overflowToDisk="false" > diskPersistent="false"> > <terracotta> > <nonstop immediateTimeout="false" timeoutMillis="30000"> > <timeoutBehavior type="exception" /> > </nonstop> > </terracotta> > </cache> > > My questions are, first, what is this cache used for (sorry for the newbie > question)? I couldn't find much documentation on this, if someone could > just point me to a link that would be awesome. Second, do I need to specify > any TTL or expiry settings like: > > timeToLiveSeconds="0" > timeToIdleSeconds="0" > diskExpiryThreadIntervalSeconds="600" > > Thanks for any help in advance! > > Thanks, > Chuck Syperski
