以下是我的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之后没有清除。
有人能帮我看看我的配置出了什么问题吗?
下面的页面说这是一个bug,但不确定如何解决?
我正在使用spring-boot-starter-cache-2.0.3版本。
https://github.com/ehcache/ehcache-jcache/issues/26
有一些类似的问题,但没有提供任何解决方案。