Next >
Tutorial: Building cache identifiers
When the dynamic cache service places an object in the cache, it labels it with a unique identifying string known as a cache ID. The cache Id constructed according to <cache-id> rules specified in the <cache-entry> elements. The <cache-id> rules define how to construct cache-ids from information associated with an application server request.
Learning objectives
The <cache-id> is formed from a list of <components>. There are several different types of components that are available to build these cache-ids. This tutorial will outline several of them.
Time required
Expect this tutorial to take about 30 minutes to complete.
Audience
This tutorial is intended for WebSphere Commerce Administrators who will be responsible for building cache identifiers.
Prerequisites
To complete this tutorial, you need WAS 6.0 and WebSphere Commerce 6.0 with the ConsumerDirect store published. You will also need a cachespec.xml that caches the TopCategoriesDisplay page and the eMarketingSpot fragment of the ConsumerDirect store.
Expected results
In this tutorial, you learned about the different methods for building cache-entries:
- WebSphere Commerce session attributes
- WAS session attributes
- Cookies
- CommandContext method calls
Lessons in this tutorial
- Add WebSphere Commerce DC_RequestAttributes
A servlet filter known as the cache filter enables the dynamic cache to use session information to construct the cache ID. The cache filter is designed to set up request attributes from the session data, MemberGroupsCacheCmd, and store relationship information. Dynamic cache can use the request attributes as component elements.- Building cache identifiers using method calls into the WebSphere Application
Cache-ids are composed from values that are in the WebSphere Application Server session. To access these values, specify a component type of session and use the value that is the name of the object in the session.- Building cache identifiers using cookies
The use of cookies does limit this component to Web-specific scenarios. You cannot use this component with other protocols, such as webservices.- Building cache identifiers using method calls into the CommandContext
It is possible to access parameters available in the CommandContext. Specifically, you can invoke methods on the CommandContext object so that certain values are accessed that would not be available.