CacheManager属性已设置--Apache Shiro

lof*_* in 7 google-app-engine shiro

如何在使用Apache shiro时设置cacheManager属性.在调试时,我得到了INFO,

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

我使用的是JSF2和Google Cloud SQL.

Les*_*ood 4

如果使用 Shiro 的 INI 配置,您可以像任何其他 bean 属性一样设置 SecurityManager 的 cacheManager 属性。例如:

[main]

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

securityManager.cacheManager = $cacheManager
Run Code Online (Sandbox Code Playgroud)

您可以使用开箱即用的 EhCacheManager 或自己实现CacheManagerCache接口来使用自定义缓存后备存储(例如 Memcache、Coherence、GigaSpaces、任何现代 NoSQL 键/值存储等...)