The caching still after 24 seconds, I tried to set expire on each saves caching but I want to be generic in the configuration
@Bean public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) { RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setConnectionFactory(connectionFactory); Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = initJackson2JsonRedisSerializer(); RedisSerializer<String> stringSerializer = new StringRedisSerializer(); template.setKeySerializer(stringSerializer); template.setHashKeySerializer(stringSerializer); template.setValueSerializer(jackson2JsonRedisSerializer); template.setHashValueSerializer(jackson2JsonRedisSerializer); template.setDefaultSerializer(jackson2JsonRedisSerializer); template.afterPropertiesSet(); template.expire(CacheType.EDITORIAL_CACHE.name(), 24, TimeUnit.SECONDS); template.expire(CacheType.S3_CACHE.name(), 24, TimeUnit.SECONDS); return template; }