Invalidating entries in a servlet cache

Use this task to invalidate a cache entry from a servlet cache instance.

Before you begin

Enable the dynamic cache service, servlet caching and develop the cachespec.xml.

About this task

After a servlet is invoked and completes generating the output to cache, a cache entry is created that contains the output and the side effects of the servlet. Perform this task so that your application can invalidate a cache entry from a servlet cache.

Procedure

  1. Enable the dynamic cache service, servlet caching, and develop the cachespec.xml.
  2. Build the application to access the servlet cache and invalidate a cache entry.
     import com.ibm.websphere.cache.ServletCache;
     import com.ibm.websphere.cache.DynamicCacheAccessor;
     
    	// obtain reference to the servlet cache instance using the cache instances jndi name
      	   ServletCache cache = DynamicCacheAccessor.getServletCacheInstance("services/cache/basecache");
    	// invalidate the cache entry using the cache ID generated as defined by the cache policy in the cachespec.xml
      	   cache.invalidateById("/dynacachetests/TimeStamp:arg1=yes:requestType=GET", true);
  3. Deploy the application.

指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: July 9, 2016 9:32
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tdyn_invalidatesc
文件名:tdyn_invalidatesc.html