Command result caching

The Command Cache introduces the next level of granularity to dynamic content caching. Its primary goal is to serve the object's content from cache and thus minimize the execution of remote messages, such as back-end database JDBC calls, or calls to access data at remote non-database servers.

Generally, the Command Cache is used to cache dynamic data that requires back-end data retrieval or additional computation or manipulation. The command result cache forms a good synergy with the servlet/JSP result cache, because, in some cases, even caching the most granular, final formatted fragment is not sufficient. For example, a home page (Figure 14-2) consists of two sets of information: "Account summary" that is highly personalized, and "Market summary" that is generalized information and usable by many users. "Account summary" is highly user sensitive and stored at the back-end server. In this case, it is not effective to cache the final formatted fragment, but rather use command

result caching.

The Command Cache is caching at the Java application level. To use Command Cache, user applications need to use the caching capabilities of the WebSphere Command Framework API. The WebSphere Command Framework is based on the Command Design Pattern widely used in Java programming paradigms. Typically, these applications use "setters" to set the command's input states, one or more execute methods, and "getters" to retrieve the results. The results can be either formatted or raw data.

The Command Cache intercepts the execute method call of a command written for Command Cache and checks whether the command object can be served from the cache. If the command object does not exist in the cache, the logic in the execute method is performed and the resulting object is cached.

The caching behavior of Command Cache is defined declaratively with the XML cache policy file, which describes whether and how a command should be cached. Command Cache can be used at the presentation and/or business logic layer in multi-tier environments.

The Command Cache is easy to use. For existing applications that follow a Model, View, and Controller (MVC) design pattern, Command Cache can be implemented with minimal impact to existing code.

  Prev | Home | Next

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.