Tutorial: Invalidating cache >
< Previous | Next >

 

Timeout


This section is related to Timeout.
You can accomplish time-based invalidation by specifying the <timeout>value</timeout> sub-element within a cache-entry in the cachespec.xml file. Value is the amount of time in seconds, the cache entry is kept in the cache. The default value for this element is 0, which indicates this entry never expires.

  1. Add a <timeout> value to the eMarketingSpot fragment.

    1. Open the cachespec.xml file located at WC_eardir\Stores.war\WEB-INF.

    2. Add the following element inside the <cache-id> of the eMarketingSpot fragment
      <timeout>10</timeout>
      
      
      

  2. Observe the time-based invalidation.

    1. Clear the entries in the cache.

    2. Hit the TopCategoriesDisplay page.

    3. View the cached entries using the cache monitor - observe that there is an entry for the eMarketingSpot.

    4. Wait 10 seconds and view the cached entries using the cache monitor - the entry for the eMarketingSpot should be gone. This method is useful when you cannot invalidate the cache entries by any other mechanism, or you should refresh them after a set period.


< Previous | Next >