mirror of https://gitee.com/stylefeng/roses
【7.2.4】更新字典默认需要引用一个缓存
parent
562b5f2f1f
commit
180e4369c8
|
@ -29,6 +29,7 @@ import cn.hutool.cache.impl.TimedCache;
|
||||||
import cn.stylefeng.roses.kernel.cache.api.constants.CacheConstants;
|
import cn.stylefeng.roses.kernel.cache.api.constants.CacheConstants;
|
||||||
import cn.stylefeng.roses.kernel.cache.memory.operator.DefaultMemoryCacheOperator;
|
import cn.stylefeng.roses.kernel.cache.memory.operator.DefaultMemoryCacheOperator;
|
||||||
import cn.stylefeng.roses.kernel.cache.memory.operator.DefaultStringMemoryCacheOperator;
|
import cn.stylefeng.roses.kernel.cache.memory.operator.DefaultStringMemoryCacheOperator;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ public class GunsMemoryCacheAutoConfiguration {
|
||||||
* @date 2021/1/31 20:39
|
* @date 2021/1/31 20:39
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(name = "defaultStringCacheOperator")
|
||||||
public DefaultStringMemoryCacheOperator defaultStringCacheOperator() {
|
public DefaultStringMemoryCacheOperator defaultStringCacheOperator() {
|
||||||
TimedCache<String, String> stringTimedCache = CacheUtil.newTimedCache(CacheConstants.DEFAULT_CACHE_TIMEOUT);
|
TimedCache<String, String> stringTimedCache = CacheUtil.newTimedCache(CacheConstants.DEFAULT_CACHE_TIMEOUT);
|
||||||
return new DefaultStringMemoryCacheOperator(stringTimedCache);
|
return new DefaultStringMemoryCacheOperator(stringTimedCache);
|
||||||
|
@ -60,6 +62,7 @@ public class GunsMemoryCacheAutoConfiguration {
|
||||||
* @date 2021/1/31 20:39
|
* @date 2021/1/31 20:39
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(name = "defaultMemoryCacheOperator")
|
||||||
public DefaultMemoryCacheOperator defaultMemoryCacheOperator() {
|
public DefaultMemoryCacheOperator defaultMemoryCacheOperator() {
|
||||||
TimedCache<String, Object> objectTimedCache = CacheUtil.newTimedCache(CacheConstants.DEFAULT_CACHE_TIMEOUT);
|
TimedCache<String, Object> objectTimedCache = CacheUtil.newTimedCache(CacheConstants.DEFAULT_CACHE_TIMEOUT);
|
||||||
return new DefaultMemoryCacheOperator(objectTimedCache);
|
return new DefaultMemoryCacheOperator(objectTimedCache);
|
||||||
|
|
|
@ -70,10 +70,10 @@
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--缓存模块-->
|
<!--缓存模块,默认依赖内存缓存实现-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.stylefeng.roses</groupId>
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
<artifactId>cache-api</artifactId>
|
<artifactId>memory-cache-spring-boot-starter</artifactId>
|
||||||
<version>${roses.version}</version>
|
<version>${roses.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue