Invalidating WebSphere Commerce data cache entries

When data in the database is created, updated, or deleted, using WebSphere Commerce tools, the cache is kept automatically up to date. Data that is updated with methods such as loading of catalog or price data might have to be invalidated with other methods of cache invalidation.


Procedure

WebSphere Commerce provides additional methods of performing cache invalidation:

  1. Use Java programming to call the methods of the WCDataCache Java class. These methods accept the database table name, and optionally the column names and values in a row that was created, updated, or deleted, and perform the appropriate cache invalidations. WCDataCache works when running within the WebSphere Commerce environment and does not work when running in a stand-alone Java utility.

  2. Define and use the database triggers defined in the wcs.cacheivl.trigger.sql script. These database triggers cause specially formulated invalidation IDs to be appended to the CACHEIVL database table, in the DATAID column. The DynaCacheInvalidationCmd scheduler job processes the CACHEIVL rows and issues appropriate cache invalidations. When this technique is used, there is a time between when the database changes are made and when the DynaCacheInvalidation scheduler job performs the invalidations. During that time period, the old stale cached data is used.

  3. For stores on the Store server, we can also use extra cache invalidation by leveraging a third-party messaging system to send out cache invalidation request and trigger invalidation of data cache object on the Store server. Apache Kafka is the supported messaging middleware.


Related concepts
Store function cache overview
Additional WebSphere Commerce data cache configuration


Related tasks
Adding database triggers to automatically update registries after data propagation


Related reference
Logical cache names and the DistributedMaps they use by default
Access bean classes extended to take advantage of WebSphere Commerce data cache
Data bean classes extended to take advantage of WebSphere Commerce data cache