Ehcache - refresh only when newer version of element is available

11 views
Skip to first unread message

laksmi iragavarapu

unread,
Dec 20, 2017, 11:50:02 PM12/20/17
to Ehcache Spring Annotations

Currently I am using Spring web framework for my Web App. I have implemented a basic CacheConfig.java file that reads ehcache.xml and that creates a CacheManager and is used to get an element from cache or adds an element to cache. My ehcache.cml is as follows:

    <cache name="Cache"
       maxEntriesLocalHeap="100"
       maxEntriesLocalDisk="0"
       eternal="false"
       diskSpoolBufferSizeMB="0"
       timeToIdleSeconds="43200"
       timeToLiveSeconds="43200"
       memoryStoreEvictionPolicy="LFU"
       >
    <persistence strategy="none"/>   

How can I ensure that cache is refreshed by first looking for the object from the backend database(SOR) and only on successful retrieval does the older version of the element get removed? Sample code would be much appreciated. Will I have to stop using ehcache.xml?

Reply all
Reply to author
Forward
0 new messages