The data has to be invalidated or removed from the cache and this will be mainly based on the relevance of cached data, based on time user or other variables. For this invalidation,Dynacache helps with different methods for performing cache invalidation. For this WCS has provided four methods of invalidating of the Cache.
- Time based invalidation
- Command based invalidation
- Dynacache API and CACHEIVL table invalidation
- Group based invalidation
Let’s discuss the above invalidation methods in detailed below,
- Time-based invalidation : This method is useful when the cache entries can’t be invalidated or the resources need to be refreshed after a set of time period. this method can be accomplished by giving the time based element in the cachespec.xml like <timeout>value</timeout>, here value is the time, in seconds. this has default value set to 0 seconds, which indicates this entry never expires that means the value will not be changed and the cached value will be the same all the time.
- Command based invalidation : Here the invalidation will be based on execution of a command, based on certain invalidation rules, that the command extends from the WebSphere commerce command framework API. here the invalidation id’s are framed based on the methods on methods and fields provided by the commands. for using this method of invalidation the commands must be in the command framework API that extends the CacheableCommandImpl class present in the com.ibm.websphere.command package. Once the created command extends the CacheableCommandImpl then the created command is eligible for command-based invalidation.