Administer > Dynamic caching


Dynamic caching considerations for persistent session

Consider the following example: The Remember Me feature has been enabled, and a guest customer returns to a store. The Remember Me (persistent session) feature in WebSphere Commerce does not require that the first request processed by the WebSphere Commerce Server be skipped by the dynamic caching facility and processed by the run time. The only caching requirement is that any request displaying user oriented data must be processed once by the WebSphere Commerce run time before it displays this data. Since pages that contain data pertaining to a particular user are not typically cached, it is acceptable to delay generating the new guest customer until a non-cacheable operation is requested where a new guest customer is created and then migrated.

Since dynamic caching does not ignore a request when a cookie does not exist, a temporary cookie is created for the first request processed by the WebSphere Commerce run time. All subsequent requests are then marked as repeat requests. This cookie, named WC_SESSION_ESTABLISHED, will have a constant value of true once created. Having a constant value across multiple session means that this cookie can be used as part of the cache key. Defining a cache entry in the cachespec.xml file, as shown in this example, ensures that only cached pages will be used if this cookie exists:

<cache-id>   

<component id="" type="pathinfo">      

<required>true</required>      

<value>/StoreCatalogDisplay</value>   

</component>   

<component id="WC_SESSION_ESTABLISHED" type="cookie">      

<required>true</required>      

</component>   

<component id="storeId" type="parameter">      

<required>true</required>      

</component>   

<component id="catalogId" type="parameter">       

<required>true</required>       

</component>
</cache-id>

You can only skip caching the first request if it is the first request processed by the WebSphere Commerce Server, and not the first request for each store of the WebSphere Commerce Server. If the WCS instance has multiple stores enabled and the customer goes to one store and then the other, this cookie will be generated at the first request for the first store. This means that cookie will exist when the request is made to the second store and the cache version of the request is used.

When the caching specification is based on DC_porg and DC_cont attributes, and the Remember Me functionality is enabled, the values for DC_porg and DC_cont are not populated until a proper authentication is performed for the remembered registered user.

To avoid excessive cache misses in these cases, the caching logic should not be based on DC_porg and DC_cont attributes.


Related concepts

Configure the dynamic cache service in cachespec.xml

Dynamic caching

Related reference

Cache defaults


+

Search Tips   |   Advanced Search