[Java programming language only]

Configuring the near cache

You can configure your clients to have a local, in-line cache. This optional cache is called a near cache, an independent data grid on each client, serving as a cache for the remote, server-side cache. The near cache is enabled by default when locking is disabled, or is configured as optimistic, and cannot be used when configured as pessimistic.

Before you begin

You must create a simple data grid in the user interface. See Creating simple data grids for more information.

About this task

A near cache is fast because it provides local in-memory access to a subset of the entire cached data set that is stored remotely. By default, the client-side near cache does not have a maximum size and out of memory errors in the client can occur. To control the size of the near cache, configure a client-side override that enables a time-to live (TTL) or least recently used (LRU) evictor on the client. For more information about overriding client settings, see Configuring Java clients with an XML configuration and Configuring Java clients programmatically.

Procedure

You can enable a near cache to be created on the client by setting the dynamic map name. You must set the dynamic map to have optimistic locking or no locking. Examples of map names that have a near-cache enabled follow:
my_grid.NONE
my_grid.NONE.O
For more information, see Configuring dynamic maps. For a list of dynamic map configuration options, see Dynamic map configuration options.

Results

To check whether a near cache is enabled, run the BackingMap.isNearCacheEnabled() method in your client. You can also look for the CWOBJ1128I message in the log files on the client to see if the near cache is enabled.