When you filter a collection in a JSP, you can cache the filtered results so that future executions of that page need not run the collection filter to produce an identical result set. A filter that uses caching attempts to reuse content cached by a previous invocation that filtered an identical collection. When no cached content can be reused, the filter executes and saves its resultant collection to the cache.

To enable caching, you need to set five properties. For example, to cache content from StartEndDateFilter, the following properties require these values:

Note: The values described in this list are the default settings for the StartEndDateFilter implementation.

FilterCache is a component of class atg.service.cache.Cache designed to handle caching for collection filtering components. You can use FilterCache to configure the caching settings.

FilterCache has a Map object that uses a key (CacheCollectionKey) to describe the filtering conditions and a value to hold the filtered results. Specifically, the CacheCollectionKey is an object that consists of:

Here’s an example of how caching could work in the StartEndDateFilter. The first call to a JSP that uses the StartEndDateFilterDroplet servlet bean relies on StartEndDateFilter to generate a collection of active objects. When caching is enabled, FilterCache saves the following information in the Map key: the StartEndDateFilter component, the catid-53009-curtains string, and a Date object that specifies the date the filter was executed. The “active” objects, those being the objects that remain after filtering, are saved to the Map as a value.

Subsequent renderings of that JSP will cause ATG 9.3 to compare the cached CacheCollectionKey key to the newly generated one. When the keys match, the filter returns the cached collection. By default, a cache is flushed once a day, which is appropriate for the StartEndDateFilter since the cached content it generates is only relevant for one day.

 
loading table of contents...