Skip to content

Instantly share code, notes, and snippets.

@oscarrenalias
Created March 1, 2013 08:28
Show Gist options
  • Save oscarrenalias/5063249 to your computer and use it in GitHub Desktop.
Save oscarrenalias/5063249 to your computer and use it in GitHub Desktop.
A better ehcache.xml configuration file for the Play Framework, which out of the box limits the size of the cache based on the number of objects you put in it rather than the number of bytes. I personally think that's not a very smart choice. Also see http://ehcache.org/documentation/2.5/configuration/cache-size#cache-configuration-sizing-attrib…
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
<!-- This is a default configuration for 256Mb of cached data using the JVM's heap, but it must be adjusted
according to specific requirement and heap sizes -->
<defaultCache
maxBytesLocalHeap="256000000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
@maxkremer
Copy link

excellent! Thanks

@songoo
Copy link

songoo commented Jul 8, 2015

Tnx, default limit was killing our server, in very slow and secret ninja way.

Copy link

ghost commented Mar 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment