Tutorial: Invalidating cache >
< Previous | Next >
Invalidating cache using dynacache API and the CACHEIVL table
This section is related to invalidating cache using dynacache API and the CACHEIVL table.
Dynacache API and the CACHEIVL table WAS dynamic caching provides the following APIs to support programmatic invalidation:
- com.ibm.websphere.cache.invalidateById
- com.ibm.websphere.cache.invalidateByTemplate
- com.ibm.websphere.cache.clear
WebSphere Commerce also provides a DynaCacheInvalidation command, which is called by the scheduler periodically to process the records in the CACHEIVL table. It then calls the WAS dynamic cache invalidation APIs to invalidate the specified cache entries. By default, the schedule interval is every ten minutes. Refer to the WebSphere Commerce's documentation on Scheduler in the WebSphere Commerce's Administration Guide on how to edit, delete, and schedule a new job. The rules for the DynaCacheInvalidation command when processing the CACHEIVL table are as follows:
- The "clearall" string value in the TEMPLATE or DATA_ID columns of the CACHEIVL table is used by DynaCacheInvalidation to clear the cache by dynamic cache invalidation API (clear).
- If the TEMPLATE column is set, then the DynaCacheInvalidation command calls the dynamic cache invalidation API (invalidateByTemplate) and uses the name as the template ID. If the "clearall" string value (which is case insensitive) is found in TEMPLATE column, then the DATA_ID column is ignored and the DynaCacheInvalidation command will clear cache. If the TEMPLATE column is not empty, the command invalidates by the template ID, ignoring the DATA_ID column.
- If the DATA_ID column is set and the template name is not set, then the DynaCacheInvalidation command calls the dynamic cache invalidation API (invalidateById) and uses the DATA_ID as the ID. If the TEMPLATE column is empty and the "clearall" string value is found in the DATA_ID column, then the command clears the cache.
- When the dynamic cache invalidation API is called, it invalidates the cache entries.