Reputation: 19468
I'm using Play Framework 2 for a search engine of sorts and the default cache that comes with it. I cache the results of each query. Surprisingly I'm getting an Out of Memory Error. I don't specify evict times, but I'm under the impression that EhCache will evict entries using the default policy (Play 2.0 ehcache.xml). Is this not the case? Can I override Play's ehcache.xml
by specifying my own conf/ehcache.xml
? What do I need to configure differently?
Update: the OOM error might have been caused by another component after some more digging. But the question still stands: will Play's EHCache evict when memory is tight? Enabling caching does cause me to have an OOM error sooner.
Upvotes: 1
Views: 468
Reputation: 1250
Based on the ehcache.xml you link to, ehcache will evict when the entry count has reached 10k entries in heap. Now you also use the diskStore, capped to 10M entries. But the disk store will still require all the keys to fit in memory... which might be the issue you are facing.
Also, note that the TTI/TTL will be honored inline. That is data is check for freshness when accessed. Ehcache does not spawn a thread that will pro-activily go and expire elements from the cache.
Hope this helps...
Upvotes: 2