CacheManager properties have been set- Apache Shiro

lofa in picture lofa in · Jan 6, 2012 · Viewed 7.8k times · Source

How can I set cacheManager properties, while using Apache shiro. On debugging , I am getting INFO like,

80104 [1045903843@qtp-967078155-3] INFO org.apache.shiro.realm.AuthorizingRealm - No cache or cacheManager properties have been set.  Authorization cache cannot be obtained.

I am using JSF2 and Google Cloud SQL.

Answer

Les Hazlewood picture Les Hazlewood · Jan 6, 2012

If using Shiro's INI config, you set the SecurityManager's cacheManager property like any other bean property. For example:

[main]

cacheManager = com.something.impl.SomeCacheManager
# config cacheManager as necessary, e.g.
# cacheManager.foo = bar

securityManager.cacheManager = $cacheManager

You can use the out-of-the-box EhCacheManager or implement the CacheManager and Cache interfaces yourself to use a custom cache backing store (e.g. Memcache, Coherence, GigaSpaces, any modern NoSQL Key/Value store, etc...)