提交 d66c2ed5 编写于 作者: zhouweidong's avatar zhouweidong

缓存开关

上级 f39f7a9e
...@@ -7,6 +7,7 @@ import com.github.benmanes.caffeine.cache.Caffeine; ...@@ -7,6 +7,7 @@ import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.CaffeineSpec; import com.github.benmanes.caffeine.cache.CaffeineSpec;
import lombok.Data; import lombok.Data;
import ${pub.getPKGCodeName()}.util.cache.cache.LayeringCache; import ${pub.getPKGCodeName()}.util.cache.cache.LayeringCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cache.Cache; import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
...@@ -39,7 +40,8 @@ public class LayeringCacheManager implements CacheManager { ...@@ -39,7 +40,8 @@ public class LayeringCacheManager implements CacheManager {
private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>(16); private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>(16);
public RedisCacheWriter redisCacheWriter; public RedisCacheWriter redisCacheWriter;
public RedisCacheConfiguration redisConfiguration; public RedisCacheConfiguration redisConfiguration;
public RedisOperations redisOperations; @Autowired
public RedisTemplate<String, Object> redisTemplate;
/** /**
* 缓存默认设置 * 缓存默认设置
...@@ -79,7 +81,7 @@ public class LayeringCacheManager implements CacheManager { ...@@ -79,7 +81,7 @@ public class LayeringCacheManager implements CacheManager {
} }
protected Cache createCache(String name) { protected Cache createCache(String name) {
return new LayeringCache(name,this.redisOperations ,this.cacheBuilder.build(),redisCacheWriter,redisConfiguration); return new LayeringCache(name,redisTemplate,this.cacheBuilder.build(),redisCacheWriter,redisConfiguration);
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册