EhCache内存限制



在我的代码中,我使用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.xml上。他给maxitemsincache的值为15000,因为缓存忽略了其他项。

最新更新