We are currently using ehcache as 2nd level cache with the following configuration in our application.
<!-- Configure 2nd level cacheing for these entities -->
<cache name="cacheEntity1"
maxElementsInMemory="1500"
eternal="true"
overflowToDisk="false"/>
<cache name="cacheEntity2"
maxElementsInMemory="3500"
eternal="true"
overflowToDisk="false"/>
We are planning to move to infinispan cache. By looking at the documentation of infinispan, we are not able to locate any XML configuration examples for defining cache entities similar to the one above using ehcache.
We are looking to configure the following attributes (maxInMemory, timeToIdleSeconds, timeToLiveSeconds ) at the hibernate entity level.
We prefer to do this configuration using XML rather than a programmatical way.
Any suggestion?
Thanks,
Sadashiv
I suggest you to configure a cache configured with an eviction strategy.
Eg. (inside your cache-container configuration)
If you wish to overflow entries to disk you can add to your local cache a persistence store.
Eg.
Eviction is typically used in conjunction with a cache store (entries are not permanently lost when evicted). Eviction only removes entries from memory and not from cache stores. See infinispan docs
You can select a different eviction strategy (NONE, UNORDERED, LRU, LIRS, MANUAL). Take in mind that some strategies are deprecated in last Infinispan versions. eviction strategies
If you want attach lifespan and/or maximum idle times to entries, Expiration is your choice. expiration
Eg.
Hope it helps.