Commit a476e3ab191b2e1ff268cb53ac154fd6c784eb2c
1 parent
53743dd0
#feat:添加redis 的cachename对应过期时间
Showing
3 changed files
with
11 additions
and
1 deletions
pom.xml
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | 6 | ||
| 7 | <groupId>com.irrigation</groupId> | 7 | <groupId>com.irrigation</groupId> |
| 8 | <artifactId>common-lib</artifactId> | 8 | <artifactId>common-lib</artifactId> |
| 9 | - <version>1.2.3</version> | 9 | + <version>1.2.4</version> |
| 10 | 10 | ||
| 11 | <properties> | 11 | <properties> |
| 12 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 12 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
src/main/java/com/irrigation/icl/cache/LayeringCacheAutoFactory.java
| @@ -32,6 +32,7 @@ public class LayeringCacheAutoFactory { | @@ -32,6 +32,7 @@ public class LayeringCacheAutoFactory { | ||
| 32 | LayeringCacheManager cacheManager = new LayeringCacheManager(redisTemplate, layeringCacheProperties); | 32 | LayeringCacheManager cacheManager = new LayeringCacheManager(redisTemplate, layeringCacheProperties); |
| 33 | cacheManager.setUsePrefix(true); | 33 | cacheManager.setUsePrefix(true); |
| 34 | long expire = layeringCacheProperties.getExpire() > 0L ? layeringCacheProperties.getExpire() : 120L; | 34 | long expire = layeringCacheProperties.getExpire() > 0L ? layeringCacheProperties.getExpire() : 120L; |
| 35 | + cacheManager.setExpires(layeringCacheProperties.getExpires()); | ||
| 35 | cacheManager.setDefaultExpiration(expire); | 36 | cacheManager.setDefaultExpiration(expire); |
| 36 | return cacheManager; | 37 | return cacheManager; |
| 37 | } | 38 | } |
src/main/java/com/irrigation/icl/cache/core/LayeringCacheProperties.java
| @@ -3,6 +3,8 @@ package com.irrigation.icl.cache.core; | @@ -3,6 +3,8 @@ package com.irrigation.icl.cache.core; | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import org.springframework.boot.context.properties.ConfigurationProperties; | 4 | import org.springframework.boot.context.properties.ConfigurationProperties; |
| 5 | 5 | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 6 | /** | 8 | /** |
| 7 | * @Author: boni | 9 | * @Author: boni |
| 8 | * @Date: 2018/8/24-下午2:59 | 10 | * @Date: 2018/8/24-下午2:59 |
| @@ -25,6 +27,13 @@ public class LayeringCacheProperties { | @@ -25,6 +27,13 @@ public class LayeringCacheProperties { | ||
| 25 | */ | 27 | */ |
| 26 | private long expire; | 28 | private long expire; |
| 27 | 29 | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * L2级缓存的过期时间,name :time | ||
| 33 | + */ | ||
| 34 | + private Map<String, Long> expires; | ||
| 35 | + | ||
| 36 | + | ||
| 28 | @Data | 37 | @Data |
| 29 | // ehcache设置 | 38 | // ehcache设置 |
| 30 | public static class L1 { | 39 | public static class L1 { |