Accessing an Entry

The region entry retrieval methods return the value associated with the specified key, and pass the callback argument to any cache loaders or cache writers that are invoked during the operation.

If the value is not available locally, it is requested from the server. If the server request is unsuccessful, a local cache loader is invoked, if one is available. The operation throws keyNotFoundException if the Region is unable to retrieve a value through any of these means.

Using the Region API to Retrieve Values From the Cache

Here, the code fragment accomplishes entry retrieval in two ways.

string value1 = region1["Key1"];
string value2 = region1["Key2"];

string valueQ = region.Get(111, null);
string valueR = region.Get(222, null);

Batch Operations—Using getAll to Return Values from Multiple Entries

The GetAll region API returns values for collection of keys from the local cache or server.

If value for a key is not present locally, then it is requested from the Java server. The value returned is not copied, so multi-threaded applications should not modify the value directly but should use the update methods.

This method is not applicable to local region instances.

This operation updates the CacheStatistics.LastAccessedTime, CacheStatistics.HitCount statistics and CacheStatistics.MissCount for this region and the returned entries.