Apache Shiro 已經有內建 Cache 機制,http://shiro.apache.org/caching.html
但也能自行 implement,整合其它的 Cache Server (JCache, Ehcache, JCS, OSCache, JBossCache, TerraCotta, Coherence, GigaSpaces)
implement 方式,可以參考這個網址
http://www.java2s.com/Open-Source/Java/Authentication-Authorization/shrio/org/apache/shiro/cache/ehcache/Catalogehcache.htm
使用時,需在 shiro.ini 增加幾行資料
#Use Infinispan HotRod Cache
cacheManager = com.test.cache.SessionCacheManager
securityManager.cacheManager = $cacheManager
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
securityManager.sessionManager.sessionDAO = $sessionDAO
沒有留言:
張貼留言