[Java programming language only][Version 8.6.1.1 and later]

Cache API in eXtreme Scale

The Cache API behaves as described in the JCache API. Because the specification does not mandate rules on how a near cache must operate, this topic describes how each Cache method affects a near cache. You can configure any cache that has a locking strategy of OPTIMISTIC or NONE to have a near cache.

In this table, X represents the key. A is the near cache value that is associated with the key. B is the far cache value that is associated with the key. C is the new value that is put into the cache. Each row is a cache method. Each column shows the value of the entry in both near and far caches. For a specific cache method, find the column that has your near and far values to learn the return value and behavior. For example, for the getAndPut(X,C) method, if near=null and far=B, the method returns B and sets near and far to C.

Table 1. Behavior of cache methods as to near and far caches. For a cache method with X and possibly A, B, or C parameter values, the table provides the return value and behavior.
Cache method If near=A and far=B If near=null and far=B If near=A and far=null
getAndPut(X,C) Return A. near=far=C Return B. near=far=C Return A. near=far=C
getAndRemove(X) Return A. near=far=null Return B. near=far=null Return A. near=far=null
getAndReplace(X,C) Return A. near=far=C Return B. near=far=C Return null. near=far=null
putIfAbsent(X,C) Return false. Do nothing. Return false. Do nothing. Return true. near=far=C
remove(X) Return true. near=far=null Return true. near=far=null Return false. near=far=null
remove(X,A) Return false. Do nothing. Return false. Do nothing. Return false. near=far=null
remove(X,B) Return true. near=far=null Return true. near=far=null Return false. near=far=null
replace(X,C) Return true. near=far=C Return true. near=far=C Return false. near=far=null
replace(X,C,A) Return false. Do nothing. Return false. Do nothing. Return false. near=far=null
replace(X,C,B) Return true. near=far=C Return true. near=far=C Return false. near=far=null