Configuring command caching

Why and when to perform this task

Cacheable commands are stored in the cache for re-use with a similar mechanism for servlets and Java Server Pages (JSP) files. However, in this case, the unique cache IDs are generated based on methods and fields present in the command as input parameters. For example, a GetStockQuote command can have a symbol as its input parameter.

A unique cache ID can generate from the name of the command, plus the value of the symbol.

To use command caching you must:

Steps for this task

  1. Create a command.
    1. Define an interface.
      The Command interface specifies the most basic aspects of a command.

      You must define the interface that extends one or more of the interfaces in the command package. The command package consists of three interfaces:

      • TargetableCommand
      • CompensableCommand
      • CacheableCommand
      In practice, most commands implement the TargetableCommand interface, which allows the command to execute remotely. The code structure of a command interface for a targetable command follows:
      ...
      import com.ibm.websphere.command.*;
      public interface MyCommand extends TargetableCommand { 
            // Declare application methods here
      }
      
    2. Provide an implementation class for the interface.
      Write an interface that extends the CacheableCommandImpl class and implements your command interface. This class contains the code for the methods in your interface, the methods inherited from extended interfaces like the CacheableCommand interface, and the required or abstract methods in the CacheableCommandImpl class.

      You can also override the default implementations of other methods provided in the CacheableCommandImpl class.


Related tasks
Configuring the dynamic cache service to improve performance
Related reference
Command class
CacheableCommandImpl class
Example: Caching a command object



Searchable topic ID:   tdyn_cachecommands
Last updated: Jun 21, 2007 9:56:50 PM CDT    WebSphere Application Server for z/OS, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/tdyn_cachecommands.html

Library | Support | Terms of Use | Feedback