+

Search Tips   |   Advanced Search

Resource cache - Personalization


Personalization uses the WebSphere Application Server Dynamic Cache service to cache the results of select rules and to cache the rules themselves in a DistributedMap. When publishing, importing or saving rules, the cache is flushed automatically to ensure that the site is current.


Configuration settings available for caching rules

The PersonalizationService.properties file contains cache control settings. The following table summarizes the configuration settings available for caching.

Description
rulesEngine.cache.enabled Global setting to disable all caching. Setting to false will override any collections that are individually set to be cached.
rulesEngine.cache.jndiName The Dynamic Cache DistributedMap to use, as specified by its JNDI name.
rulesEngine.cache.maxEnumSize Although the DistributedMap may be configured in the WAS admin console to limit the maximum number of entries in the cache, the collection of resources that is returned for each rule is counted as one entry in the cache. When a rule returns a very large number of results, caching the results may result in extra memory overhead. Therefore, when the result set of a rule exceeds the number specified in this property, it will not be cached.
rulesEngine.cache.timeout The number of seconds before an entry in the cache expires.
rulesEngine.cache.priority The priority of a cache entry, relative to other entries in the same DistributedMap.
rulesEngine.cache.enabled.collectionName The same as rulesEngine.cache.enabled, except that this property applies to a specific resource collection. The variable collectionName is the fully qualified path to the resource collection in Personalization. For instance, the GeneralNews resource collection that is included in the sample folder called PznDemo has the collectionName of /PznDemo/GeneralNews.
rulesEngine.cache.jndiName.collectionName The same as rulesEngine.cache.jndiName, except that this property applies to a specific resource collection.
rulesEngine.cache.maxEnumSize.collectionName The same as rulesEngine.cache.maxEnumSize, except that this property applies to a specific resource collection.
rulesEngine.cache.timeout.collectionName The same as rulesEngine.cache.timeout, except that this property applies to a specific resource collection.
rulesEngine.cache.priority.collectionName The same as rulesEngine.cache.priority, except that this property applies to a specific resource collection.


Caching business rules for resources

You might need to programmatically flush the Personalization cache, for example when a resource is updated outside of Personalization rules through some other application. A programming interface is provided to flush the cache. Since the timeout interval for the cache can be specified in the properties file, in many cases it may be adequate to wait for the cache timeout before updates are seen. The class com.ibm.websphere.personalization.resources.cache.CacheManager can be used to invalidate the cache for a particular resource, a particular resource collection, or the entire cache. Personalization uses this class internally to flush the cache when updates occur.

Flushing the cache for a particular resource may require that all cached queries be flushed. Flushing the cache on a collection may flush the cache for all collections using the same dynamic cache map. When the application frequently flushes the cache for a particular collection, isolating that collection in its own cache map through the use of the ruleEngine.cache.jndiName.resourceCollectionName property will result in better cache utilization.

Caching occurs before any rule exits are called.

For more information about using the DistributedMap and DistributedObjectCache interfaces for the dynamic cache, refer to the IBM WAS Information Center.


Parent: Personalization programming reference
Related:

Use the DistributedMap and DistributedObjectCache interfaces for the dynamic cache