Search in sources :

Example 1 with RedisKeySerializer

use of com.jn.agileway.redis.core.serialization.RedisKeySerializer 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);
}
Also used : DelegatableRedisSerializer(com.jn.agileway.redis.core.serialization.DelegatableRedisSerializer) GenericJackson2JsonRedisSerializer(org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer) StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) RedisSerializer(org.springframework.data.redis.serializer.RedisSerializer) DelegatableRedisSerializer(com.jn.agileway.redis.core.serialization.DelegatableRedisSerializer) RedisKeyWrapper(com.jn.agileway.redis.core.key.RedisKeyWrapper) RedisKeySerializer(com.jn.agileway.redis.core.serialization.RedisKeySerializer)

Example 2 with RedisKeySerializer

use of com.jn.agileway.redis.core.serialization.RedisKeySerializer in project agileway by fangjinuo.

the class RedisTemplates method createRedisTemplate.

public static RedisTemplate<String, ?> createRedisTemplate(@NonNull RedisConnectionFactory connectionFactory, @NonNull RedisKeyWrapper keyWrapper, @NonNull RedisSerializer<?> valueSerializer, @Nullable ClassLoader beanClassLoader, @Nullable RedisSerializer<String> stringSerializer, @Nullable RedisSerializer<?> hashKeySerializer, @Nullable RedisSerializer<?> hashValueSerializer, @Nullable RedisLuaScriptRepository redisLuaScriptRepository, boolean enableTx, boolean initIt) {
    RedisKeySerializer redisKeySerializer = new RedisKeySerializer();
    redisKeySerializer.setKeyWrapper(keyWrapper);
    return createRedisTemplate(connectionFactory, redisKeySerializer, valueSerializer, beanClassLoader, stringSerializer, hashKeySerializer, hashValueSerializer, redisLuaScriptRepository, enableTx, initIt);
}
Also used : RedisKeySerializer(com.jn.agileway.redis.core.serialization.RedisKeySerializer)

Aggregations

RedisKeySerializer (com.jn.agileway.redis.core.serialization.RedisKeySerializer)2 RedisKeyWrapper (com.jn.agileway.redis.core.key.RedisKeyWrapper)1 DelegatableRedisSerializer (com.jn.agileway.redis.core.serialization.DelegatableRedisSerializer)1 GenericJackson2JsonRedisSerializer (org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer)1 RedisSerializer (org.springframework.data.redis.serializer.RedisSerializer)1 StringRedisSerializer (org.springframework.data.redis.serializer.StringRedisSerializer)1