Just wanted to know if there was a performance impact to setting a maxElementsInMemory much higher than what is actually used? For example, a max of 10,000 and using only 100.
ehcache.xml
<defaultCache
eternal="false"
overflowToDisk="false"
maxElementsInMemory="10000"
timeToIdleSeconds="7200"
timeToLiveSeconds="0"/>
Context: I am using ehcache with hibernate and I want all records of a table (all entities) to be cached. From one customer to another, the number of records in that table varies so it is hard to set a precise max.
Thanks!
Marc
No, there is none. This is just a max value. If your cache only holds 100 items, you will pay the cost of a map holding 100 elements. The upper limit has nothing to do here.
You can safely use much higher limit (underneath it is a simple ConcurrentHashMap
) although it is hard to justify such a choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With