About Pagelet Caching
Caching is the functionality that allows ALI and Ensemble
to request pagelet content, save the content, and return the saved
content to users when appropriate. The importance of caching cannot
Efficient caching makes every web application faster and less expensive.
The only time content should not be cached is if the data must be
continuously updated. If every pagelet had to be freshly generated
for each request, performance could become unacceptably slow. ALI
and Ensemble rely on caching to improve performance. Pagelet content
is cached and returned when later requests match the cache’s existing
Caching is indexed on the settings sent by the pagelet. When the
ALI or Ensemble gateway server processes a request for a page, it
looks individually at each pagelet on the page and checks it against
the cache. The process can be summarized as follows:
- The gateway server assembles a cache key used to uniquely identify
each pagelet in the cache.
- The gateway server checks the cache for a matching cache key entry:
- If the gateway server finds a match that is not expired, it returns
the content in the cache and does not make a request to the remote
- If there is no matching cache key for the pagelet or if the cache
key has expired, the gateway server makes a request to the remote
server. If the matching cache entry uses ETag or Last-Modified caching,
it also sends the appropriate caching header to the remote server
in the request.
- The response comes back from the remote server; the gateway server
checks for caching headers:
- If the headers include an Expires header, the gateway server stores
the new pagelet content (along with a new expiration date) in its
- If the headers use ETag or Last-Modified caching, the existing
cache entry might be revalidated (in the case of ‘304-Not Modified’)
or new pagelet content might be stored in the cache.
ALI and Ensemble cache gatewayed content to complement, not replace,
browser caching. Public content is accessible to multiple users without
any user-specific information (based on HTTP headers). The gateway
server calculates the cache headers sent to the browser to ensure
that the content is properly cached on the client side.
ALI and Ensemble cache all text (i.e., nonbinary) content returned
by GET requests. Even if gateway caching is disabled (via PTSpy),
pagelet caching still takes place. Gatewayed content can be cached
by a proxy server or by the user’s browser. Beware browser caching
of gatewayed content; it is a good idea to clear your browser cache
often during development. An incorrectly set Expires header can cause
browsers to cache gatewayed content.
The pagelet cache contains sections of finished markup and sections
of markup that require further transformation. Post-cache processing
means content can be more timely and personalized. Adaptive tags enable
certain pagelets (for example, Community banners) to be cached publicly
for extended periods of time and yet contain user specific and page-specific
information, as well as the current date and time.
For details, see the following topics:
For a full explanation of HTTP caching, see RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616.html).
- About Pagelet Caching StrategiesPagelet caching is controlled both by the programmer and by the administrator who registers the pagelet in ALI or Ensemble. Each and every pagelet needs a tailored caching strategy to fit its specific functionality.
- Pagelet/Portlet Cache KeyThe cache key for a pagelet/portlet entry in ALI consists of these values.
- Setting HTTP Caching Headers - Cache-ControlThe Cache-Control header can be used to expire content immediately or disable caching altogether. The value of this header determines whether cached portlet content can be shared among different users.
- Setting HTTP Caching Headers - ExpiresThe Expires header specifies when content will expire, or how long content is “fresh.” After this time, the Portal Server will always check back with the remote server to see if the content has changed.
- Setting HTTP Caching Headers - Last-Modified and ETagThe Last-Modified response header specifies the last time a change was made in the returned content, in the form of a time stamp. ETag values are unique identifiers generated by the server and changed every time the object is modified. Either can be used to determine if cached content is up to date.
- Implementing Portlet CachingCaching on the Portal Server can be set in two ways: programmatically through HTTP headers and/or using the administrative settings in the Portlet Web Service Editor. You should always implement caching programmatically, although the administrator can still choose to override caching through administrative settings.
- Configuring ALI Portlet Caching SettingsIn ALI , the HTTP Configuration page of the Web Service editor allows portal administrators to set minimum and maximum validation times for cached portlet content.