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?