Home
Rule-based invalidation
Another form of invalidation, less commonly used in WebSphere Commerce, but similar to command-based invalidation, is rule-based invalidation. Example | -3 demonstrates this concept by invalidating a cache entry based on a request parameter.
When the parameter with the name action has a value of update, the cache entries having the dependency ID category are made invalid. They are removed from the cache. Like command-based caching, the invalidation rule in rule-based invalidation is specified inside the <invalidation> tags. The component sub-element indicates the condition, that is, the action parameter must have the string value update.
Example 3-3 Rule-based invalidation
<cache-entry><name>newscontroller </name><class>servlet</class>
<cache-id><component id="action" type="parameter"><value>view</value><required>true</required></component><component id="category" type="parameter"><required>true</required></component><component id="layout" type="session"><required>false</required></component></cache-id>
<dependency-id>category<component id="category" type="parameter"><required>true</required></component></dependency-id>
<invalidation>category<component id="action" type="parameter" ignore-value="true"><value>update</value><required>true</required></component><component id="category" type="parameter"><required>true</required></component></invalidation>
</cache-entry>