Home | 2.6.4 Cache IDs and the cache hit | 2.6.6 Dependency ID overview <dependency-id>
2.6.5 Cache programming support
DynaCache provides other capabilities in addition to servlet and JSP caching. Cache IDs also define how information is obtained programmatically from Cacheable Command objects, that is, objects that implement the DynaCache Command interface. There is more coverage on Command objects later.
In summary, for an object to be cached, DynaCache must know how to generate a unique ID for different invocations of that object.
Cache IDs can be developed in one of the following ways:
- Using your XML <cache-id> element definitions inserted into the cache policy of a cache entry.
- Writing custom Java code to build the ID from input variables and system state. The custom Java code is placed in a WebSphere shared library so that it can be accessed by the runtime. Custom ID generators, although not common, are useful when application processing "state" is a factor in creating the identifiers.
Although each cache entry may have multiple cache-ID rules, only one of the entries in the list of rules is executed at any one time. DynaCache searches through the list of cache IDs in the exact order you defined them in the cachespec.xml file. It keeps looking for a rule until it finds one that matches, or it exhausts the list.
In the case where none of the <cache-id> generation rules produce a matching cache ID, then the object is not cached.