Configuring a near cache for the dynamic cache
You can enable near cache in your dynamic cache provider so that an independent data grid exists on your dynamic cache provider, serving as a fast cache for the remote, server-side cache.
About this task
Modify the backingMap of the objectgrid.xml file to enable near cache in dynamic cache.
The dynacache-nearcache-objectgrid.xml file is included in both the client and server installations. You can copy or modify this file as needed. This file is already configured as described in the following instructions. In most cases you can use this file without significant changes. The dynacache-nearcache-objectgrid.xml file is in thewas_root/optionalLibraries/ObjectGrid/dynacache/etc or wxs_home/ObjectGrid/dynacache/etc directory.
Procedure
true
; for
example:<backingMap name="IBM_DC_PARTITIONED_.*" template="true" readOnly="false"
< pluginCollectionRef="all" preloadMode="false" nearCacheEnabled="true"
nearCacheInvalidationEnabled="true" nearCacheLastAccessTTLSyncEnabled= "true"
lockStrategy="OPTIMISTIC"
copyMode="COPY_ON_READ_AND_COMMIT" ttlEvictorType="NONE" nullValuesSupported="false" />
Each
of the attributes on the backingMap element have the following definitions: - nearCacheEnabled
- Set the value to true to enable the client local cache. To use a near
cache, the lockStrategy attribute must be set to NONE or
OPTIMISTIC. If the lockStrategy attribute must is set to
NONE or OPTIMISTIC, the
nearCacheEnabled property is set to true.
Default: true (Optional)
- 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. To enable a near cache for a dynamic cache instance, this value
must be set to true.
Default: false (Optional)
- nearCacheLastAccessTTLSyncEnabled
- Set the value to true to enable time-to-live (TTL) information to be
synchronized with the remote data grid. To enable a near cache for a dynamic cache instance, this
value must be set to true. If you are not using a dynamic cache near cache,
you must enable the LAST_ACCESS_TIME TTL evictor type when you enable this
property.Attention: Setting the value to true for a dynamic cache near cache is now optional.
Default: false (Optional)
What to do next
- Configure the com.ibm.websphere.xs.dynacache.near_cache_size custom property to specify the maximum number of cache entries that are allowed in the near cache. For more information, see Dynamic cache custom properties.