【问题标题】:EhCache Memory limitEhCache 内存限制
【发布时间】:2016-12-21 21:04:12
【问题描述】:

在我的代码中,我使用 EhCache 来存储一个对象。代码如下

@Resource(name = "ehCacheManager")
private CacheManager manager;
private Ehcache cache;
public void testCache(){    
 cache = manager.getCache("ehSubjects");
 for loop to read subjects data{ //This loops runs 15051 times
 final Element element = new Element(subject.subjectId(), subject);
 cache.put(element);
 }
}
System.out.println("Cache Size:"+cache.getSize()); //15000

问题是有 15051 个主题对象,但是当循环之后我尝试打印缓存大小时,它总是给我 15000。

那么我们可以在 EhCache 中保留的对象数量是否有限制?

【问题讨论】:

  • 请为 Ehcache 添加任何相关的配置信息。否则很难回答。

标签: caching ehcache


【解决方案1】:

问题在于其他队友定义的 ehcache.xml。他将 maxitemsincache 值设为 15000,因为 cahce 忽略了其他项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-14
    • 1970-01-01
    • 2014-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-26
    • 2014-07-16
    相关资源
    最近更新 更多