Back to JOC 10.1.2 Tutorial Index

Invalidating and Destroying Cache Objects

Objects can be removed from the cache either by setting the time to live attribute for the object, group or region, or by explicitly invalidating or destroying the object. Invalidating an individual object in the cache will mark the object for removal from the cache. Destroying an individual object will mark the object and the associated environment (loader, event handlers, attributes) for removal from the cache.

Invalidating a region or group will invalidate all the individual objects within the region or group, leaving the environment, all groups, loaders, defined attributes, etc. in the cache. Destroying a region or group will mark all objects associated with the region or group for removal including the associated environment.

An object may be invalidated or destroyed automatically based on a time to live or idle time attribute. By default the objects will be invalidated not destroyed. If the objects should be destroyed when the time expires the Attributes.GROUP_TTL_DESTROY flag must be set (see the Cache Object Attributes chapter for details on setting attributes). If an object, group or region is defined as distributed the destroy or invalidate request will be propagated to all caches in the system, see Distributed Cache for details.

To invalidate an object, group or region use the CacheAccess.invalidate() method

  CacheAccess cacc = CacheAccess.getAccess("Stock-Market");

  cacc.invalidate("CPS");  // invalidate an individual object "CPS"
  cacc.invalidate("NYSE"); // invalidate all objects associated with the group "NYSE"
  cacc.invalidate();       // invalidate all objects associated with the region "Stock-Market"
To destroy an object, group or region use the CacheAccess.destroy() method
  CacheAccess cacc = CacheAccess.getAccess("Stock-Market");

  cacc.destroy("loaded object"); // destroy an individual object "loaded object"
  cacc.destroy("NYSE");          // destroy all objects associated with the group "NYSE"
                                 // and the group and loader
  cacc.destroy();                // destroy all objects associated with the region "Stock-Market"
                                 // including groups and loaders
Destroying a region will also close the CacheAccess object that was used to access the region.

Back to JOC 10.1.2 Tutorial Index

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy