下面是我的 ehcache 配置文件
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true"
monitoring="autodetect"
dynamicConfig="true">
<diskStore path="java.io.tmpdir" />
<cache name="trans"
maxEntriesLocalHeap="10000"
maxEntriesLocalDisk="1000"
eternal="false"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="0"
timeToLiveSeconds="6"
memoryStoreEvictionPolicy="LFU"
transactionalMode="off">
<persistence strategy="localTempSwap" />
</cache>
</ehcache>
所有 Spring 注释和配置都正常工作
@Component
@CacheConfig(cacheNames = {"trans" })
public class MyTransService {
private List<Trans> list;
@Autowired
private EhCacheCacheManager manage;
@PostConstruct
public void setup() {
list = new ArrayList<>();
}
@CachePut
public void addTransaction(Trans trans) {
this.list.add(trans);
}
@CacheEvict(allEntries = true)
public void deleteAll() {
this.list.clear();
}
}
但是在timetoliveseconds之后缓存没有得到清除。
有人可以帮助我我的配置有什么问题吗?
下面的页面说这是错误,但不知道如何解决这个问题?
我使用的是 spring-boot-starter-cache-2.0.3 版本
https://github.com/ehcache/ehcache-jcache/issues/26
有一些类似的问题,但没有提供任何解决方案
慕姐4208626
喵喔喔
相关分类