most caches use the default 10K maxElementsInMemory, This is likely very wasteful as ehcache doesn't evict elements from an in memory cache:
"Because the memory store has a fixed maximum number of elements, it will have a maximum memory use equal to the number of elements * the average size. When an element is added beyond the maximum size, the LRU element gets pushed into the DiskStore.
most caches use the default 10K maxElementsInMemory, This is likely very wasteful as ehcache doesn't evict elements from an in memory cache:
"Because the memory store has a fixed maximum number of elements, it will have a maximum memory use equal to the number of elements * the average size. When an element is added beyond the maximum size, the LRU element gets pushed into the DiskStore.
While we could have an expiry thread to expire elements periodically, it is far more efficient to only check when we need to. The tradeoff is higher average memory use."
http://ehcache.org/documentation/faq.html#Why_is_there_an_expiry_thread_for_the_DiskStore_but_not_for_the_MemoryStore
Also