Caching

 

+

Search Tips   |   Advanced Search

 

  1. Caching content
  2. Cache scope
  3. Expiry time
  4. Page scope and expiry
  5. Themes: scope and expiry
  6. Portlet Definitions: scope and expiry
  7. Portlet Windows: scope and expiry
  8. Portlet Wide: scope and expiry
  9. Default cache scope and expiry time settings
  10. Factors affecting cache scope and expiry time
  11. Limitations
  12. Security Issues
  13. Troubleshooting

 

Caching content

You can cache shared content on a proxy server such as WebSphere Edge Server.

Configure cache scope and expiry time by...

...using...

  1. XML configuration interface
  2. Manage Pages portlet
  3. Manage Portlets portlet
  4. Properties portlet

When caching JSR portlets, the cache scope is only for proxy server caching policies and requires the use of an edge server cache. Local display caching policies are not affected by this setting. The cache expiration setting is used for both local and remote caching policies.

 

Cache scope

The cache scope determines where the content will be cached. There are two types of caching:

 

Expiry time

How long the page is stored in a cache.

Three options...

Cache always expires The content will never be cached in either a shared or a private cache.

Set the remote cache expiry to 0

Cache never expires The content can be stored indefinitely in either a shared or a private cache.

Set the remote cache expiry to -1

Cache expires after this many seconds The content will be stored for the number of seconds specified in either a shared or a private cache.

Set the remote cache expiry to a positive integer up to 2^31 -1

 

Pages: scope and expiry

Resources that contribute to the remote cache information on a portal page...

Contributes Key Possible values Set via XML Access Set via UI
remote cache scope com.ibm.portal.remote-cache-scope SHARED, NON_SHARED yes yes
remote cache expiry com.ibm.portal.remote-cache-expiry Time in seconds, given as an integer between -1 and the value ((2 to the power of 31)-1)

Use the value -1 if you never want the cache to expire.

yes yes
Ignore Access Control in Caches com.ibm.portal.IgnoreAccessControlInCaches True, False yes yes

Use Edit Page Properties to set page cache options...

Example for XML access:

<parameter name"com.ibm.portal.remote-cache-scope">SHARED</parameter>
<parameter name"com.ibm.portal.remote-cache-expiry">3000</parameter>
<parameter name"com.ibm.portal.IgnoreAccessControlInCaches">true</parameter>

 

Themes: scope and expiry

Resources that contribute to the overall remote cache information for themes...

Contributes Key Possible values Set via XML Access Set via UI
remote cache scope com.ibm.portal.remote-cache-scope SHARED, NON_SHARED yes no
remote cache expiry com.ibm.portal.remote-cache-expiry Time in seconds, given as an integer between -1 and the value ((2 to the power of 31)-1)

Use the value -1 if you never want the cache to expire.

yes no

Example for XML access:

<parameter name"com.ibm.portal.remote-cache-scope">SHARED</parameter>
<parameter name"com.ibm.portal.remote-cache-expiry">3000</parameter>

 

Portlet Definitions: scope and expiry

Resources that contribute to the overall remote cache information on a portlet definition...

Contributes Key Possible values Set via deployment descriptor Set via UI
remote cache scope remote-cache-scope SHARED, NON_SHARED yes no
expiration cache EXPIRATION_CACHE Time in seconds, given as an integer between -1 and the value ((2 to the power of 31)-1)

Use the value -1 if you never want the cache to expire.

yes yes
remote cache dynamic remote-cache-dynamic True, False yes no

WebSphere Portal uses EXPIRATION_CACHE to determine the lifetime of the portlet's output in a remote cache just like the remote cache expiry for themes.

The remote cache dynamic setting is an optimization to notify the container whether a portlet window can publish remote cache information at render time.

The deployment descriptor specification shows how to deal with these settings.

 

Portlet Windows: scope and expiry

Remote cache information on a portlet window...

Contributes Key Possible values Set via deployment descriptor Set via UI
remote cache scope remote-cache-scope SHARED, NON_SHARED No. Published during render time No
expiration cache EXPIRATION_CACHE Time in seconds, given as an integer between -1 and the value ((2 to the power of 31)-1)

Use the value -1 if you never want the cache to expire.

No. Published during render time No

The portlet definition describes the portlet at a deployment time level given in the portlet deployment descriptor. Attributes specified in the deployment descriptor are valid on all occurrences on all pages of this portlet.

The portlet window describes the runtime entity for a portlet.

While in the rendering phase of a portlet, the portlet can publish values or attributes via an API. Thus, attributes specified while rendering the portlet is portlet instance specific.

Example code snippet for publishing the information at render time:

String paramExpiry = "3000";
String paramScope = "SHARED";
renderResponse.setProperty("portlet.remote-cache-scope", paramScope );
renderResponse.setProperty(RenderResponse.EXPIRATION_CACHE, paramExpiry );

 

Portlet Wide: scope and expiry

Resources that contribute to the overall remote cache information on portlet wide settings...

Contributes Key Possible values Set via XML Access Set via UI
remote cache expiration remote.cache.expiration Time in seconds, given as an integer between -1 and the value ((2 to the power of 31)-1)

Use the value -1 if you never want the cache to expire.

No. Property in WP NavigatorService no
vary vary List of HTTP header fields that can be put into the vary response header No. Property in WP NavigatorService no

 

Default cache scope and expiry time settings

The following table shows possible WP NavigatorService settings:

Key Meaning Default value
public.session Whether an anonymous user always has a session, which may be useful when a portlet requires a session for anonymous users.

Setting public.session to true reduces performance.

false
public.expires The cache expiration time (in seconds) for the unpersonalized page. 60 sec
public.reload Time (in seconds) that unauthenticated pages reload. 60 sec
remote.cache.expiration Maximum cache lifetime of any page (both public and private). 60 sec
vary HTTP headers that force a proxy to cache different variants of the same URL. Accept-Language user-Agent

 

Factors affecting cache scope and expiry time

Multiple factors can affect the cache scope and expiry time for a page. The remote-cache-scope and remote.cache.expiration of a rendered page view is calculated as the minimum of the following factors:

 

Limitations

With the above settings, it is possible to generate an HTTP response header like Cache-Control: max-age=-1, which indicates an unlimited cache expiration when a page is rendered. This is beyond the HTTP 1.1 specification but if a proxy cache does not support an unlimited cache expiration, WebSphere Portal supports it. If the cache infrastructure does not properly work with this response header, set the remote.cache.expiration value in the WP NavigatorService to a large value. To set an unlimited cache expiration is not possible if the cache infrastructure does not support it.

 

Security Issues

Storing authenticated pages in a shared cache introduces security holes. If a malicious user discovered the URL for an authenticated page, that user could read pages containing private information. By default, WebSphere Portal does not permit shared caching for authenticated pages. Use the Properties portlet or the XML configuration interface to override these default settings using the com.ibm.portal.IgnoreAccessControlInCaches parameter, but in most cases this is not recommended.

In some rare circumstances, it might be useful to store authenticated pages in a shared cache. For example, if all authenticated users receive identical content, then storing authenticated pages in a shared cache might be acceptable.

 

Troubleshooting

In general, you should monitor the cache hit rate on the proxy server and adjust the cache size appropriately.

If the hit rate is lower than expected, increase the cache size. You can also check the following item:

 

Parent topic

Configure portal behavior