AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

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 be overstated.

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 settings.

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:
  1. The gateway server assembles a cache key used to uniquely identify each pagelet in the cache.
  2. 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 server.
    • 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.
  3. 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 cache.
    • 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 a full explanation of HTTP caching, see RFC 2616 (

  Back to Top      Previous Next