cachespec.xml setup examples
This is the cachespec.xml configuration file used to set the configuration parameters for Trade. The following stanza is set for the various caching modes used.
<?xml version="1.0"?>
<!DOCTYPE cache SYSTEM "cachespec.dtd">
<!--
DynaCache specification for WebSphere performance application.
Trade provides a sample application for DynaCache usage and configuration.
-->
<cache>
<cache-entry>
<class>servlet</class>
<name>/app</name>
<!-- Cacheid and dependency-id for the Portfolio page. This page is invalidated
when a stock buy/sell order has been
completed. -->
<cache-id>
<component id="action" type="parameter">
<value>portfolio</value>
<required>true</required>
</component>
<component id="JSESSIONID" type="cookie">
<required>true</required>
</component>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
</cache-id>
<!-- Special case for TradeScenarioServlet to invoke Portfolio and DynaCache
not to return an ESI include
but actually invoke the portfolio operation
-->
<cache-id>
<component id="action" type="parameter">
<value>portfolioNoEdge</value>
<required>true</required>
</component>
<component id="JSESSIONID" type="cookie">
<required>true</required>
</component>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">false</property>
</cache-id>
<!-- Dependency-id for the portfolio page -->
<dependency-id>Holdings_UserID
<component id="action" type="parameter" ignore-value="true">
<value>portfolio</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is to invalidate the portfolio page when the user
is logged out. The account and
home pages are invalidated when the user is logged out based on the
dependency id Account_UserID -->
<dependency-id>Holdings_UserID1
<component id="action" type="parameter" ignore-value="true">
<value>portfolio</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<dependency-id>Holdings_UserID
<component id="action" type="parameter" ignore-value="true">
<value>portfolioNoEdge</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<!-- Cacheid and dependency id for the Account page. This page is invalidated
when the account profile has been updated or
a stock buy/sell order has been completed. -->
<cache-id>
<component id="action" type="parameter">
<value>account</value>
<required>true</required>
</component>
<component id="JSESSIONID" type="cookie">
<required>true</required>
</component>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
</cache-id>
<!-- Dependency-id for the account page -->
<dependency-id>Account_UserID
<component id="action" type="parameter" ignore-value="true">
<value>account</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<dependency-id>AccountProfile_UserID
<component id="action" type="parameter" ignore-value="true">
<value>account</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<!-- Cache id for the Trade Home page. This page is invalidated when ever there
is a change in the account information or
the holdings information -->
<cache-id>
<component id="action" type="parameter">
<value>home</value>
<required>true</required>
</component>
<component id="JSESSIONID" type="cookie">
<required>true</required>
</component>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
</cache-id>
<dependency-id>Account_UserID
<component id="action" type="parameter" ignore-value="true">
<value>home</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<dependency-id>Holdings_UserID
<component id="action" type="parameter" ignore-value="true">
<value>home</value>
<required>true</required>
</component>
<component id="uidBean" type="session">
<required>true</required>
</component>
</dependency-id>
<!-- Cache entry for the quotes page. This page will be invalidated whenever
a quote of a symbol is invalidated -->
<cache-id>
<component id="action" type="parameter">
<value>quotes</value>
<required>true</required>
</component>
<component id="symbols" type="parameter">
<required>true</required>
</component>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
</cache-id>
<dependency-id>AllQuotes
<component id="action" type="parameter" ignore-value="true">
<value>quotes</value>
<required>true</required>
</component>
</dependency-id>
<dependency-id>Quote_Symbol
<component id="action" type="parameter" ignore-value="true">
<value>quotes</value>
<required>true</required>
</component>
</dependency-id>
</cache-entry>
<!-- Cache entry for register.jsp which is included in the Welcome.jsp -->
<cache-entry>
<class>servlet</class>
<name>/register.jsp</name>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
<cache-id>
<timeout>180</timeout>
</cache-id>
</cache-entry>
<!-- Cache entry for marketSummary.jsp. This jsp gets invalidated on a timeout
as well as when Trade database is reset -->
<cache-entry>
<class>servlet</class>
<name>/marketSummary.jsp</name>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
<cache-id>
<priority>3</priority>
<timeout>180</timeout>
</cache-id>
<dependency-id>MarketSummary
</dependency-id>
</cache-entry>
<!-- Cache entry for displayQuote.jsp. This page is invalidated for each
individual symbol when that symbol is updated with the updateQuotePriceCommand -->
<cache-entry>
<class>servlet</class>
<name>/displayQuote.jsp</name>
<property name="consume-subfragments">true</property>
<property name="EdgeCacheable">true</property>
<cache-id>
<component id="symbol" type="parameter">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- This dependency id is setup to identify stocks by their symbol
-->
<dependency-id>Quote_Symbol
<component id="symbol" type="parameter">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all Quotes
for commands which invalidate all Quote entries
-->
<dependency-id>AllQuotes
</dependency-id>
</cache-entry>
<!--
The MarketSummaryCommand is cached and invalidated on a timeout.
Time based invalidation is a simple, yet common usage for caching.
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.MarketSummaryCommand
</name>
<cache-id>
<priority>3</priority>
<timeout>10</timeout>
</cache-id>
<dependency-id>MarketSummary
</dependency-id>
</cache-entry>
<!--
The QuoteCommand is used to cache Quote symbols and prices.
QuoteCommands are invalidated for each individual symbol when that
symbol is updated with the UpdateQuotePriceCommand
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.QuoteCommand
</name>
<cache-id>
<component type="method" id="getSymbol">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- This dependency id is setup to identify stocks by their symbol
-->
<dependency-id>Quote_Symbol
<component id="getSymbol" type="method">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all Quotes
for commands which invalidate all Quote entries
-->
<dependency-id>AllQuotes
</dependency-id>
</cache-entry>
<!--
The UpdateQuotePriceCommand is used to update the current price for
a stock symbol. This invalidates the QuoteCommand cache-entry above
for the individual stock, identified by getSymbol. The getSymbol method
ties this entry to the dependency id for the QuoteCommand cache-entry above
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.UpdateQuotePriceCommand</name>
<invalidation>Quote_Symbol
<component id="getSymbol" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<!--
The AccountCommand is used to cache a user's Account information.
AccountCommands are invalidated for each individual user when that
user's account information, such as their account balance,
is updated by a trading operation
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.AccountCommand</name>
<cache-id>
<component type="method" id="getUserID">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- This dependency id is setup to identify user Accounts by the userID
-->
<dependency-id>Account_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all user Accounts
for commands which invalidate all Account cache entries
-->
<dependency-id>AllUsers
</dependency-id>
</cache-entry>
<!--
The AccountProfileCommand is used to cache a user's Account profile information.
AccountProfileCommands are invalidated for each individual user when that
user's account profile information is updated by the UpdateAccountProfileCommand
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.AccountProfileCommand</name>
<cache-id>
<component type="method" id="getUserID">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- This dependency id is setup to identify user Account Profiles by
the userID -->
<dependency-id>AccountProfile_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all user Account
for commands which invalidate all Account Profile cache entries
-->
<dependency-id>AllUsers
</dependency-id>
</cache-entry>
<!--
The HoldingsCommand is used to cache a user's Stock holdings information.
HoldingCommands are invalidated for each individual user when that
user's holdings change due to an OrderCompletedCommand
-->
<cache-entry>
class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.HoldingsCommand</name>
<cache-id>
<component type="method" id="getUserID">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- This dependency id is setup to identify user Accounts by the userID
-->
<dependency-id>Holdings_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all user Accounts
for commands which invalidate all Account Holdings cache entries
-->
<dependency-id>AllUsers
</dependency-id>
</cache-entry>
<!--
The OrdersCommand is used to cache a user's Orders information.
OrdersCommands are invalidated for each individual user when that
user's enters a new order with a BuyCommand or SellCommand.
The OrdersCommand is also invalidated when an order status is changed
by the OrderCompletedCommand
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.OrdersCommand</name>
<cache-id>
<component type="method" id="getUserID">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- The dependency id is setup to identify user Accounts by the userID
-->
<dependency-id>Orders_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all user Accounts
for commands which invalidate all Account Orders cache entries
-->
<dependency-id>AllUsers
</dependency-id>
</cache-entry>
<!--
The LoginCommand and LogoutCommands update a user's account information.
The cache-entries below invalidate the AccountCommand for an
individual userID on login and logout
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.LoginCommand</name>
<invalidation>Account_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.LogoutCommand</name>
<invalidation>Account_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
<invalidation>Holdings_UserID1
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<!--
The OrderCompletedCommand signifies that a buy or sell
order has completed for an individual user.
When an order completes, a user's holdings and account balance
have been modified.
This invalidates the AccountCommand, HoldingsCommand and OrdersCommand
for that user.
Also, it signifies that an order is completed, therefore,
on the next request, the ClosedOrderCommand should run to alert the user
of any completed orders.
The cache-entries below perform these invalidations for an individual user
on order completion.
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.OrderCompletedCommand</name>
<invalidation>Account_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
<invalidation>Holdings_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
<invalidation>Orders_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
<invalidation>ClosedOrders_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<!--
The Buy and Sell commands initiate a new orderThis creates a new order in the
database and therefore
invalidates the OrdersCommand.
Note that because order-processing in Trade is asynchronous,
a buy does not invalidate the user's portfolio or
account balance. These are invalidated when order completes.
(See OrderCompleteCommand entry in this file.)
A sell invalidates the user's portfolio
(to denote that a holding is being sold)
Buys and sells invalidate the OrdersCommand for the user
which entered the order.
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.BuyCommand</name>
<invalidation>Orders_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.SellCommand</name>
<invalidation>Orders_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
<invalidation>Holdings_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<!--
The UpdateAccountProfileCommand is used to update an individual user's
account profile information. This invalidates the AccountProfileCommand
cache-entry above for the individual user, identified by getUserID.
The getUserID method ties this entry to the dependency id for the
AccountProfileCommand cache-entry above
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.UpdateAccountProfileCommand
</name>
<invalidation>AccountProfile_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>
<!--
The ClosedOrdersCommand provides the Order completed alert mechanism in
Trade. ClosedOrdersCommand is used to check to see if a user
has any orders which have been closed, but the user has not been
alerted to the Orders status.
The ClosedOrdersCommand is cached for each individual user and
invalidated when an Order is completed by the OrderCompletedCommand
in this file.
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.ClosedOrdersCommand</name>
<cache-id>
<component type="method" id="getUserID">
<required>true</required>
</component>
<priority>3</priority>
</cache-id>
<!-- The dependency id is setup to identify stocks by their symbol
-->
<dependency-id>ClosedOrders_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</dependency-id>
<!-- This dependency id is setup to identify all user Accounts
for commands which invalidate all Account ClosedOrders cache entries
-->
<dependency-id>AllUsers
</dependency-id>
</cache-entry>
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.ClosedOrdersCommand</name>
<invalidation>ClosedOrders_UserID
<component id="getClosedOrdersCount" type="method">
<not-value>0</not-value>
<required>true</required>
</component>
</invalidation>
</cache-entry>
<!--
The ResetTradeCommand is used to reset the Trade database.
This action invalidates all cache entries for users and quotes and
the current MarketSummary
-->
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.ResetTradeCommand</name>
<invalidation>AllQuotes
</invalidation>
<invalidation>AllUsers
</invalidation>
<invalidation>MarketSummary
</invalidation>
</cache-entry>
</cache>