You can configure near-cache invalidation
to remove stale data from the near cache as quickly as possible. When
an update, deletion, or invalidation operation is run against the
remote data grid, an asynchronous invalidation operation gets triggered
in the near cache. This mechanism works more quickly than the other
option of using time-to-live (TTL) eviction in the near cache.
Before you begin
- You must be using IBM eXtremeIO. For more information, see Configuring IBM eXtremeIO (XIO).
- You must be using a near cache. To determine whether near cache
is enabled, run the BackingMap.isNearCacheEnabled() method in your client. For more information about configuring the
near cache, see Configuring the near cache.
About this task
Enabling near-cache invalidation provides a more accurate
set of data from the remote data grid because the near cache is updated
when the remote data changes.
You can edit the
necessary settings in the ObjectGrid XML file for your container
server. The settings in this file apply to all clients, unless you
override the settings. If you enable near-cache invalidation on the
server, you can disable the near-cache invalidation on the client
by overriding the nearCacheInvalidationEnabled attribute for the near cache with either XML or programmatic configuration.
However, you cannot override the attribute to enable the near-cache
invalidation when near-cache invalidation is disabled on the server.
For more information about overriding client settings, see Configuring Java clients with an XML configuration and Configuring Java clients programmatically.
Procedure
- Set the nearCacheInvalidationEnabled attribute in the ObjectGrid descriptor XML file. Set
this attribute on the backingMap element. For more information, see ObjectGrid descriptor XML file.
nearCacheInvalidationEnabled
- Set the value to true to enable the removal
of stale data from the near cache as quickly as possible. Any update
, deletion, or invalidation operation against the data grid triggers
an asynchronous invalidation in the near cache. Because the invalidation
is asynchronous, client applications might access stale data for a
short time period after an update has occurred before the stale value
is removed from the near cache. To use near cache invalidation, the lockStrategy attribute must be set to NONE or OPTIMISTIC.
Default: false (Optional)
- Restart the container servers and clients. For more information, see Starting and stopping stand-alone servers and Configuring container servers in WebSphere Application Server.