代码setup.java中看到ehcache作为二级缓存,应该可以是这么用------------------------------
// 检查一下Ehcache CacheManager 是否正常
CacheManager cacheManager = ioc.get(CacheManager.class);
// Cache cache = cacheManager.getCache("shiro-activeSessionCache");
// // 3. 创建元素
// Element element = new Element("key1", "value1");
那redis类似上面怎么写
8 回复
就是开启这个配置
;-------------Redis作为shiro二级缓存时启用这里---------
;jedisAgent = org.nutz.integration.jedis.JedisAgent
;cacheManager_ehcache = org.apache.shiro.cache.ehcache.EhCacheManager
;cacheManager_ehcache.cacheManagerConfigFile=classpath:ehcache.xml
;cacheManager_redis = org.nutz.plugins.cache.impl.redis.RedisCacheManager
;cacheManager_redis.mode=kv
;cacheManager_redis.debug=true
;cacheManager_redis.ttl=3600000
;cacheManager = org.nutz.plugins.cache.impl.lcache.LCacheManager
;cacheManager.jedisAgent = $jedisAgent
;cacheManager.level1 = $cacheManager_ehcache
;cacheManager.level2 = $cacheManager_redis
;-------------Redis作为shiro二级缓存时启用这里---------
添加回复
请先登陆