| Line 8... |
Line 8... |
| 8 |
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
8 |
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
| 9 |
import org.springframework.cache.annotation.EnableCaching;
|
9 |
import org.springframework.cache.annotation.EnableCaching;
|
| 10 |
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
10 |
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
| 11 |
import org.springframework.context.annotation.Bean;
|
11 |
import org.springframework.context.annotation.Bean;
|
| 12 |
import org.springframework.context.annotation.Configuration;
|
12 |
import org.springframework.context.annotation.Configuration;
|
| - |
|
13 |
import org.springframework.context.annotation.PropertySource;
|
| 13 |
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
14 |
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
| 14 |
import org.springframework.data.redis.cache.RedisCacheManager;
|
15 |
import org.springframework.data.redis.cache.RedisCacheManager;
|
| 15 |
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
16 |
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
| 16 |
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
17 |
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
| 17 |
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
18 |
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
| Line 19... |
Line 20... |
| 19 |
import java.time.Duration;
|
20 |
import java.time.Duration;
|
| 20 |
import java.util.concurrent.TimeUnit;
|
21 |
import java.util.concurrent.TimeUnit;
|
| 21 |
|
22 |
|
| 22 |
@Configuration
|
23 |
@Configuration
|
| 23 |
@EnableCaching
|
24 |
@EnableCaching
|
| - |
|
25 |
@PropertySource("classpath:application.properties")
|
| 24 |
public class CacheConfig extends CachingConfigurerSupport {
|
26 |
public class CacheConfig extends CachingConfigurerSupport {
|
| 25 |
|
27 |
|
| 26 |
@Override
|
28 |
@Override
|
| 27 |
@Bean
|
29 |
@Bean
|
| 28 |
public CacheManager cacheManager() {
|
30 |
public CacheManager cacheManager() {
|
| Line 113... |
Line 115... |
| 113 |
return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(jedisConnectionFactory())
|
115 |
return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(jedisConnectionFactory())
|
| 114 |
.cacheDefaults(cacheConfiguration().entryTtl(Duration.ofHours(6)))
|
116 |
.cacheDefaults(cacheConfiguration().entryTtl(Duration.ofHours(6)))
|
| 115 |
.build();
|
117 |
.build();
|
| 116 |
}
|
118 |
}
|
| 117 |
@Bean
|
119 |
@Bean
|
| - |
|
120 |
public CacheManager redisOneDayCacheManager() {
|
| - |
|
121 |
return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(jedisConnectionFactory())
|
| - |
|
122 |
.cacheDefaults(cacheConfiguration().entryTtl(Duration.ofDays(1)))
|
| - |
|
123 |
.build();
|
| - |
|
124 |
}
|
| - |
|
125 |
@Bean
|
| 118 |
public CacheManager redisFortnightlyCacheManage() {
|
126 |
public CacheManager redisFortnightlyCacheManage() {
|
| 119 |
return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(jedisConnectionFactory())
|
127 |
return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(jedisConnectionFactory())
|
| 120 |
.cacheDefaults(cacheConfiguration().entryTtl(Duration.ofDays(15).minusMinutes(5)))
|
128 |
.cacheDefaults(cacheConfiguration().entryTtl(Duration.ofDays(15).minusMinutes(5)))
|
| 121 |
.build();
|
129 |
.build();
|
| 122 |
}
|
130 |
}
|