Main Home:  |  Tel: +1.630.355.6292   |  Global Offices  

Troubleshooting common Caching Issues

Is there a way in which we can invalidate cache for a particular Application object and Resource collection on demand through portlets ?

Yes, If you are using the Application object in a visibility rule then disabling the visibility rule cache should address this issue.

These are the methods that you could use to invalidate the entire visibility rule cache or a particular rule within the visibility rule cache
invalidate(request, rulename)

-request is the PortletRequest and
-ruleName is a String relative to the Personalization Workspace. ( RULESWORKSPACE).

public static void invalidate(HttpServletRequest req) – Invalidates all visibility rule caching for the current user

public static void invalidate(HttpServletRequest req, String rule) –
Invalidates visibility cache for the rule specified for the current user

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 file, in many cases it may be adequate to wait for the cache timeout before updates are seen.

The class 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 WebSphere Application Server Information Center.

Does Caching need to be disabled at the master level in order to disable any particular resource collection?

You don’t have to disable the master level caching at rulesEngine.cache.enabled = false as it will cause performance impact.

A sample is as follows


The resource collection that is cached is wcmWebContentCollection and it is being cached under the default distributedMap dynacache instance

Another good resource is
(Page visibility rules and unreachable Search results)

In a scenario in which data fetched by the resource collection is liable to change at runtime within the same session and same goes for the application object as well. What is the best practice to be followed with respect to performance without Compromising the functionality ?

You could always invalidate the cache for a particular rule. 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.

Can we set the personalization visibility rule to a mode like NOT_SHARED for the Dynacache implementation? If so, how is this set and should it be set?

Visibility rules cache is per session, so that does not use dynacache.

Posted in Faqs




Copyright ©2020 All Rights Reserved.