File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed
src/main/java/com/pig4cloud/plugin/cache Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 3232<dependency >
3333 <groupId >com.pig4cloud.plugin</groupId >
3434 <artifactId >multilevel-cache-spring-boot-starter</artifactId >
35- <version >0.0.3 </version >
35+ <version >0.0.4 </version >
3636</dependency >
3737```
3838
Original file line number Diff line number Diff line change 55 <parent >
66 <groupId >org.springframework.boot</groupId >
77 <artifactId >spring-boot-starter-parent</artifactId >
8- <version >2.3.4 .RELEASE</version >
8+ <version >2.3.5 .RELEASE</version >
99 <relativePath /> <!-- lookup parent from repository -->
1010 </parent >
1111 <groupId >com.pig4cloud.plugin</groupId >
1212 <artifactId >multilevel-cache-spring-boot-starter</artifactId >
13- <version >0.0.3 </version >
13+ <version >0.0.4 </version >
1414 <name >multilevel-cache-spring-boot-starter</name >
1515 <description >support L1 caffeine and L2 redis cache</description >
1616 <url >https://pig4cloud.com</url >
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ public class MultilevelCacheAutoConfiguration {
2929 @ ConditionalOnBean (RedisTemplate .class )
3030 public RedisCaffeineCacheManager cacheManager (
3131 CacheConfigProperties cacheConfigProperties ,
32- RedisTemplate <Object , Object > redisTemplate ) {
33- return new RedisCaffeineCacheManager (cacheConfigProperties , redisTemplate );
32+ RedisTemplate <Object , Object > stringKeyRedisTemplate ) {
33+ return new RedisCaffeineCacheManager (cacheConfigProperties , stringKeyRedisTemplate );
3434 }
3535
3636 @ Bean
Original file line number Diff line number Diff line change 66import lombok .extern .slf4j .Slf4j ;
77import org .springframework .cache .support .AbstractValueAdaptingCache ;
88import org .springframework .data .redis .core .RedisTemplate ;
9+ import org .springframework .data .redis .serializer .StringRedisSerializer ;
910import org .springframework .util .CollectionUtils ;
1011import org .springframework .util .StringUtils ;
1112
@@ -166,6 +167,8 @@ protected Object lookup(Object key) {
166167 return value ;
167168 }
168169
170+ // 避免自动一个 RedisTemplate 覆盖失效
171+ stringKeyRedisTemplate .setKeySerializer (new StringRedisSerializer ());
169172 value = stringKeyRedisTemplate .opsForValue ().get (cacheKey );
170173
171174 if (value != null ) {
You can’t perform that action at this time.
0 commit comments