Invalidating and Destroying Regions
Invalidation marks all entries contained in the region as invalid (with null values). Destruction removes the region and all of its contents from the cache.
You can execute these operations explicitly in the local cache in the following ways:
- Through direct API calls from the client.
- Through expiration activities based on the region’s statistics and attribute settings.
In either case, you can perform invalidation and destruction as a local or a distributed operation.
- A local operation affects the region only in the local cache.
- A distributed operation works first on the region in the local cache and then distributes the operation to all other caches where the region is defined. This is the proper choice when the region is no longer needed, or valid, for any application in the distributed system.
- If the region on the server is configured as a partitioned region, it cannot be cleared using API calls from the client.
A user-defined cache writer can abort a region destroy operation. Cache writers are synchronous listeners with the ability to abort operations. If a cache writer is defined for the region anywhere in the distributed system, it is invoked before the region is explicitly destroyed.
Region invalidation and destruction can cause other user-defined application plug-ins to be invoked as well. These plug-ins are described in detail in the Overview of Application Plug-Ins.
Whether carried out explicitly or through expiration activities, invalidation and destruction cause event notification.