Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

RedisCacheManager json serializer

@Bean
public RedisCacheManager redisCacheManager(LettuceConnectionFactory lettuceConnectionFactory) {
    RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig()
            .disableCachingNullValues()
            .entryTtl(Duration.ofHours(1))
            .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.json()));
    redisCacheConfiguration.usePrefix();

   return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(lettuceConnectionFactory)
                    .cacheDefaults(redisCacheConfiguration).build();

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #RedisCacheManager #json #serializer
ADD COMMENT
Topic
Name
7+1 =