use of com.jn.agileway.redis.core.key.RedisKeyWrapper in project agileway by fangjinuo.
the class RedisTemplates method createRedisTemplate.
public static RedisTemplate<String, ?> createRedisTemplate(@NonNull RedisConnectionFactory connectionFactory, RedisTemplateProperties redisTemplateProperties, @Nullable ClassLoader beanClassLoader, @Nullable RedisLuaScriptRepository redisLuaScriptRepository, boolean initIt) {
RedisKeyWrapper keyWrapper = new RedisKeyWrapper(redisTemplateProperties.getKey());
RedisSerializer<String> keySerializer = new RedisKeySerializer(keyWrapper);
Codec<?> codec = newCodec(redisTemplateProperties.getValueCodecType());
RedisSerializer<?> valueSerializer = new DelegatableRedisSerializer(codec);
RedisSerializer hashKeySerializer = new RedisKeySerializer();
return createRedisTemplate(connectionFactory, keySerializer, valueSerializer, beanClassLoader, stringRedisSerializer, hashKeySerializer, valueSerializer, redisLuaScriptRepository, redisTemplateProperties.isTransactionEnabled(), initIt);
}
use of com.jn.agileway.redis.core.key.RedisKeyWrapper 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;
}
Aggregations