【发布时间】:2013-03-14 09:15:05
【问题描述】:
我有一个 ehcache 的实现,它不使用 xml 中的任何配置,但如下所示:
private Ehcache cache;
constructor {
cache = CacheManager.getInstance().addCacheIfAbsent("nameOfCache");
CacheConfiguration config = cache.getCacheConfiguration();
config.eternal("false")
config.setTimeToLiveSeconds(<someTime>);
}
现在,我以前使用过番石榴缓存,我知道通过在番石榴缓存中将驱逐时间设置为0,它会关闭缓存。但是通过阅读有关 ehcache 的文档,我了解到情况并非如此。有没有其他方法可以关闭缓存?
【问题讨论】: