Home
5.4 Invalidating cached objects
As described in the previous chapter, invalidation of cache objects is initiated declaratively through the cachespec.xml, programmatically using the DynaCache API, or administratively, for example, using the WebSphere Commerce scheduler or Cache Monitor. When possible, invalidation policies are declared in the cachespec.xml. This allows you to remove only a stale subset of objects in the cache, rather than clearing the entire cache. Invalidating the entire cache is not recommended and should be avoided whenever possible.
Although invalidation policies are not included in the default cachespec.xml, several invalidation examples can be found here:
WC_installdir/samples/DynaCache/invalidation
In general avoid the use of timeouts since the timeout will override other invalidation triggers and may invalidate a cached object that may not be stale. Instead, use commands, database triggers, or inactivity to initiate invalidation of cached objects.
To use command-based invalidation, your commands must conform to the WebSphere Command Framework and extend the CacheableCommandImpl class.