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.
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...)
It seems like EhCacheManager is not part of shiro-core 1.2.1 (in the Maven package anyway). I solved the problem by adding the following to my [main] section in shiro.ini:
[main]
builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $builtInCacheManager
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With