Search in sources :

Example 1 with RedisCacheFactory

use of com.jn.agileway.redis.l2cache.RedisCacheFactory in project agileway by fangjinuo.

the class ShiroRedisCacheManager method createCache.

@Override
protected Cache createCache(String cacheName) throws CacheException {
    RedisKeyWrapper redisCacheKeyWrapper = new RedisKeyWrapper().prefix("shiro_redis:" + cacheName);
    RedisCacheContext cacheContext = new RedisCacheContext();
    cacheContext.setLoader(loader);
    cacheContext.setRedisTemplate(redisTemplate);
    cacheContext.setKeyWrapper(redisCacheKeyWrapper);
    cacheContext.setRemoveListener(removeListener);
    RedisCache redisCache = new RedisCacheFactory().get(cacheContext);
    ShiroRedisCache shiroRedisCache = new ShiroRedisCache();
    shiroRedisCache.setRedisCache(redisCache);
    shiroRedisCache.setKeyCodec(keyCodec);
    return shiroRedisCache;
}
Also used : RedisCacheFactory(com.jn.agileway.redis.l2cache.RedisCacheFactory) RedisCache(com.jn.agileway.redis.l2cache.RedisCache) RedisCacheContext(com.jn.agileway.redis.l2cache.RedisCacheContext) RedisKeyWrapper(com.jn.agileway.redis.core.key.RedisKeyWrapper)

Aggregations

RedisKeyWrapper (com.jn.agileway.redis.core.key.RedisKeyWrapper)1 RedisCache (com.jn.agileway.redis.l2cache.RedisCache)1 RedisCacheContext (com.jn.agileway.redis.l2cache.RedisCacheContext)1 RedisCacheFactory (com.jn.agileway.redis.l2cache.RedisCacheFactory)1