K
- the type of key.V
- the type of value.public class CacheProxy<K,V> extends Object
This proxy is the implementation of ICache and javax.cache.Cache which is returned by HazelcastServerCacheManager. It represents a cache for server or embedded mode.
Each cache method actually is an operation which is sent to related partition(s) or node(s). Operations are executed on partition's or node's executor pools and the results are delivered to the user.
In order to access a CacheProxy by name, a cacheManager should be used. It's advised to use
ICache
instead.
Modifier and Type | Field and Description |
---|---|
protected CacheConfig<K,V> |
cacheConfig |
protected ICacheService |
cacheService |
protected ILogger |
logger |
protected String |
name |
protected String |
nameWithPrefix |
protected CacheOperationProvider |
operationProvider |
protected SerializationService |
serializationService |
Modifier | Constructor and Description |
---|---|
protected |
CacheProxy(CacheConfig cacheConfig,
NodeEngine nodeEngine,
ICacheService cacheService,
HazelcastServerCacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
protected void |
addListenerLocally(String regId,
javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
void |
clear() |
protected void |
clearInternal() |
void |
close() |
protected void |
closeCacheLoader() |
protected void |
closeListeners() |
boolean |
containsKey(K key) |
void |
countDownCompletionLatch(int id) |
void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
protected void |
deregisterCompletionLatch(Integer countDownLatchId) |
void |
destroy() |
protected void |
ensureOpen() |
V |
get(K key) |
V |
get(K key,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Retrieves the mapped value of the given key using a custom
ExpiryPolicy . |
Map<K,V> |
getAll(Set<? extends K> keys) |
Map<K,V> |
getAll(Set<? extends K> keys,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Gets a collection of entries from the cache with custom expiry policy, returning them as
Map of the values associated with the set of keys requested. |
V |
getAndPut(K key,
V value) |
V |
getAndPut(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Associates the specified value with the specified key in this cache using a custom
ExpiryPolicy ,
returning an existing value if one existed. |
ICompletableFuture<V> |
getAndPutAsync(K key,
V value)
Asynchronously associates the specified value with the specified key in this cache,
returning an existing value if one existed.
|
ICompletableFuture<V> |
getAndPutAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously associates the specified value with the specified key in this cache,
returning an existing value if one existed using a custom
ExpiryPolicy . |
V |
getAndRemove(K key) |
ICompletableFuture<V> |
getAndRemoveAsync(K key)
Asynchronously removes the entry for a key and returns the previously assigned value or null
if no value was assigned.
|
V |
getAndReplace(K key,
V value) |
V |
getAndReplace(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Atomically replaces the assigned value of the given key by the specified value using a
custom
ExpiryPolicy and returns the previously assigned value. |
ICompletableFuture<V> |
getAndReplaceAsync(K key,
V value)
Asynchronously replaces the assigned value of the given key by the specified value and returns
the previously assigned value.
|
ICompletableFuture<V> |
getAndReplaceAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously replaces the assigned value of the given key by the specified value using a
custom
ExpiryPolicy and returns the previously assigned value. |
InternalCompletableFuture<V> |
getAsync(K key)
Asynchronously retrieves the mapped value of the given key using a custom
ExpiryPolicy . |
InternalCompletableFuture<V> |
getAsync(K key,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously gets an entry from cache using a custom
ExpiryPolicy . |
javax.cache.CacheManager |
getCacheManager() |
<C extends javax.cache.configuration.Configuration<K,V>> |
getConfiguration(Class<C> clazz) |
protected String |
getDistributedObjectName() |
CacheStatistics |
getLocalCacheStatistics()
Directly access to local Cache Statistics.
|
String |
getName() |
protected NodeEngine |
getNodeEngine() |
protected ICacheService |
getService() |
protected String |
getServiceName() |
<T> T |
invoke(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
protected <T> InternalCompletableFuture<T> |
invoke(Operation op,
Data keyData,
boolean completionOperation) |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
boolean |
isClosed() |
Iterator<javax.cache.Cache.Entry<K,V>> |
iterator() |
void |
loadAll(Set<? extends K> keys,
boolean replaceExistingValues,
javax.cache.integration.CompletionListener completionListener) |
void |
put(K key,
V value) |
void |
put(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Associates the specified value with the specified key in the cache using a custom
ExpiryPolicy . |
void |
putAll(Map<? extends K,? extends V> map) |
void |
putAll(Map<? extends K,? extends V> map,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Copies all of the entries from the given map to the cache using a custom
ExpiryPolicy . |
InternalCompletableFuture<Void> |
putAsync(K key,
V value)
Asynchronously associates the specified value with the specified key in the cache.
|
InternalCompletableFuture<Void> |
putAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously associates the specified value with the specified key in the cache using
a custom
ExpiryPolicy . |
protected <T> InternalCompletableFuture<T> |
putAsyncInternal(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy,
boolean isGet,
boolean withCompletionEvent) |
boolean |
putIfAbsent(K key,
V value) |
boolean |
putIfAbsent(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Associates the specified key with the given value if and only if there is not yet
a mapping for the specified key defined.
|
InternalCompletableFuture<Boolean> |
putIfAbsentAsync(K key,
V value)
Asynchronously associates the specified key with the given value if and only if there is not yet
a mapping for the specified key defined.
|
InternalCompletableFuture<Boolean> |
putIfAbsentAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously associates the specified key with the given value if and only if there is not yet
a mapping for the specified key defined.
|
protected InternalCompletableFuture<Boolean> |
putIfAbsentAsyncInternal(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy,
boolean withCompletionEvent) |
void |
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
protected Integer |
registerCompletionLatch(int count) |
boolean |
remove(K key) |
boolean |
remove(K key,
V oldValue) |
void |
removeAll() |
void |
removeAll(Set<? extends K> keys) |
protected void |
removeAllInternal(Set<? extends K> keys) |
InternalCompletableFuture<Boolean> |
removeAsync(K key)
Asynchronously removes the mapping for a key from this cache if it is present.
|
InternalCompletableFuture<Boolean> |
removeAsync(K key,
V oldValue)
Asynchronously removes the mapping for the given key if and only if the
currently mapped value equals to the value of oldValue.
|
protected <T> InternalCompletableFuture<T> |
removeAsyncInternal(K key,
V oldValue,
boolean hasOldValue,
boolean isGet,
boolean withCompletionEvent) |
protected String |
removeListenerLocally(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
boolean |
replace(K key,
V value) |
boolean |
replace(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Atomically replaces the assigned value of the given key by the specified value
using a custom
ExpiryPolicy . |
boolean |
replace(K key,
V oldValue,
V newValue) |
boolean |
replace(K key,
V oldValue,
V newValue,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Atomically replaces the currently assigned value for the given key with the specified
newValue if and only if the currently assigned value equals the value of
oldValue using a custom
ExpiryPolicy . |
ICompletableFuture<Boolean> |
replaceAsync(K key,
V value)
Asynchronously replaces the assigned value of the given key by the specified value.
|
ICompletableFuture<Boolean> |
replaceAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously replaces the assigned value of the given key by the specified value
using a custom
ExpiryPolicy . |
ICompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronously replaces the currently assigned value for the given key with the specified
newValue if and only if the currently assigned value equals the value of
oldValue.
|
ICompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously replaces the currently assigned value for the given key with the specified
newValue if and only if the currently assigned value equals the value of
oldValue using a custom
ExpiryPolicy . |
protected <T> InternalCompletableFuture<T> |
replaceAsyncInternal(K key,
V oldValue,
V newValue,
javax.cache.expiry.ExpiryPolicy expiryPolicy,
boolean hasOldValue,
boolean isGet,
boolean withCompletionEvent) |
int |
size()
Total entry count.
|
protected void |
submitLoadAllTask(OperationFactory operationFactory,
javax.cache.integration.CompletionListener completionListener) |
<T> T |
unwrap(Class<T> clazz) |
protected void |
updateCacheListenerConfigOnOtherNodes(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration,
boolean isRegister) |
protected void |
validateCacheLoader(javax.cache.integration.CompletionListener completionListener) |
protected void |
waitCompletionLatch(Integer countDownLatchId) |
protected void |
waitCompletionLatch(Integer countDownLatchId,
int offset) |
protected final ILogger logger
protected final CacheConfig<K,V> cacheConfig
protected final String name
protected final String nameWithPrefix
protected final ICacheService cacheService
protected final SerializationService serializationService
protected final CacheOperationProvider operationProvider
protected CacheProxy(CacheConfig cacheConfig, NodeEngine nodeEngine, ICacheService cacheService, HazelcastServerCacheManager cacheManager)
public boolean containsKey(K key)
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
public boolean remove(K key)
public void removeAll()
public void clear()
public <C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)
public <T> T invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments) throws javax.cache.processor.EntryProcessorException
javax.cache.processor.EntryProcessorException
public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
public String getName()
public javax.cache.CacheManager getCacheManager()
public <T> T unwrap(Class<T> clazz)
public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
protected void updateCacheListenerConfigOnOtherNodes(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration, boolean isRegister)
public InternalCompletableFuture<V> getAsync(K key)
ICache
ExpiryPolicy
. If no mapping exists null is returned.
If the cache is configured for read-through operation mode, the underlying
configured CacheLoader
might be called to retrieve
the value of the key from any kind of external resource.
key
- the key whose associated value is to be returnedjavax.cache.Cache#get(K)
,
ICompletableFuture
public InternalCompletableFuture<V> getAsync(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
If the cache is configured for read-through operation mode, the underlying
configured CacheLoader
might be called to retrieve
the value of the key from any kind of external resource.
key
- the key whose associated value is to be returnedexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to ICache.getAsync(Object)
javax.cache.Cache#get(K)
,
ICompletableFuture
public InternalCompletableFuture<Void> putAsync(K key, V value)
ICache
In case a previous assignment already exists, the previous value is overridden by the new given value.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returnedvalue
- the value to be associated with the specified keyjavax.cache.Cache#put(K,V)
,
ICompletableFuture
public InternalCompletableFuture<Void> putAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
In case a previous assignment already exists, the previous value is overridden by the new given value.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returnedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to ICache.putAsync(Object, Object)
javax.cache.Cache#put(K,V)
,
ICompletableFuture
public InternalCompletableFuture<Boolean> putIfAbsentAsync(K key, V value)
ICache
This is equivalent to:
if (!cache.containsKey(key)) {} cache.put(key, value); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is to be associatedvalue
- the value to be associated with the specified keyjavax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
public InternalCompletableFuture<Boolean> putIfAbsentAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
This is equivalent to:
if (!cache.containsKey(key)) {} cache.put(key, value); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is to be associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to
ICache.putIfAbsentAsync(Object, Object, javax.cache.expiry.ExpiryPolicy)
javax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndPutAsync(K key, V value)
ICache
In case a previous assignment already exists, the previous value is overridden by
the new given value and the previous value is returned to the caller. This is
equivalent to the Map.put(Object, Object)
operation.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returnedvalue
- the value to be associated with the specified keyjavax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndPutAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
In case a previous assignment already exists, the previous value is overridden by
the new given value and the previous value is returned to the caller. This is
equivalent to the Map.put(Object, Object)
operation.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returned.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to ICache.getAndPutAsync(Object, Object, javax.cache.expiry.ExpiryPolicy)
javax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
public InternalCompletableFuture<Boolean> removeAsync(K key)
ICache
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returnedjavax.cache.Cache#remove(K)
,
ICompletableFuture
public InternalCompletableFuture<Boolean> removeAsync(K key, V oldValue)
ICache
This is equivalent to:
if (cache.containsKey(key) && equals(cache.get(key), oldValue) { cache.remove(key); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returned.oldValue
- the value expected to be associated with the specified key.javax.cache.Cache#remove(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndRemoveAsync(K key)
ICache
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returnedjavax.cache.Cache#getAndRemove(K)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V value)
ICache
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key whose associated value is to be returnedvalue
- the value to be associated with the specified keyjavax.cache.Cache#replace(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to ICache.replaceAsync(Object, Object)
javax.cache.Cache#replace(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
ICache
This is equivalent to:
if (cache.containsKey(key) && equals(cache.get(key), oldValue) { cache.put(key, newValue); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedoldValue
- the value expected to be associated with the specified keynewValue
- the value to be associated with the specified keyjavax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
This is equivalent to:
if (cache.containsKey(key) && equals(cache.get(key), oldValue) { cache.put(key, newValue); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedoldValue
- the value expected to be associated with the specified keynewValue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to ICache.replaceAsync(Object, Object, Object)
javax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndReplaceAsync(K key, V value)
ICache
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedvalue
- the value to be associated with the specified keyjavax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndReplaceAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
and returns the previously assigned value.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.getAndReplace(Object, Object)
javax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
public V get(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
If no mapping exists null is returned.
If the cache is configured for read-through operation mode, the underlying
configured CacheLoader
might be called to retrieve
the value of the key from any kind of external resource.
key
- the key whose associated value is to be returnedexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.get(Object)
javax.cache.Cache#get(K)
public Map<K,V> getAll(Set<? extends K> keys, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
Map
of the values associated with the set of keys requested.
If the cache is configured for read-through operation mode, the underlying
configured CacheLoader
might be called to retrieve
the values of the keys from any kind of external resource.
keys
- the keys whose associated values are to be returnedexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.getAll(java.util.Set)
Cache.getAll(java.util.Set)
public void put(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.key
- the key with which the specified value is to be associatedvalue
- value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.put(Object, Object)
javax.cache.Cache#put(K,V)
public V getAndPut(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
,
returning an existing value if one existed.key
- the key with which the specified value is to be associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.getAndPut(Object, Object)
javax.cache.Cache#getAndPut(K,V)
public void putAll(Map<? extends K,? extends V> map, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
Puts of single entries happen atomically but there is no transactional guarantee over the complete putAll operation. If other concurrent operations modify or remove all or single values of the provided map, the result is undefined.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the values of the keys to any kind of external resource.
map
- the mappings to be stored in this cacheexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.putAll(java.util.Map)
Cache.putAll(java.util.Map)
public boolean putIfAbsent(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
This is equivalent to:
if (!cache.containsKey(key)) {} cache.put(key, value); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is to be associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.putIfAbsent(Object, Object)
javax.cache.Cache#putIfAbsent(K,V)
public boolean replace(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
This is equivalent to:
if (cache.containsKey(key) && equals(cache.get(key), oldValue) { cache.put(key, newValue); return true; } else { return false; }except that the action is performed atomically.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedoldValue
- the value expected to be associated with the specified keynewValue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.replace(Object, Object, Object)
javax.cache.Cache#replace(K,V,V)
public boolean replace(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.replace(Object, Object)
javax.cache.Cache#replace(K,V)
public V getAndReplace(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
ExpiryPolicy
and returns the previously assigned value.
If the cache is configured for write-through operation mode, the underlying
configured CacheWriter
might be called to store
the value of the key to any kind of external resource.
key
- the key with which the specified value is associatedvalue
- the value to be associated with the specified keyexpiryPolicy
- custom expiry policy for this operation,
a null value is equivalent to Cache.getAndReplace(Object, Object)
javax.cache.Cache#getAndReplace(K,V)
public int size()
ICache
public CacheStatistics getLocalCacheStatistics()
ICache
protected <T> InternalCompletableFuture<T> invoke(Operation op, Data keyData, boolean completionOperation)
protected <T> InternalCompletableFuture<T> removeAsyncInternal(K key, V oldValue, boolean hasOldValue, boolean isGet, boolean withCompletionEvent)
protected <T> InternalCompletableFuture<T> replaceAsyncInternal(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy, boolean hasOldValue, boolean isGet, boolean withCompletionEvent)
protected <T> InternalCompletableFuture<T> putAsyncInternal(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy, boolean isGet, boolean withCompletionEvent)
protected InternalCompletableFuture<Boolean> putIfAbsentAsyncInternal(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy, boolean withCompletionEvent)
protected void clearInternal()
protected void removeAllInternal(Set<? extends K> keys)
protected void addListenerLocally(String regId, javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
protected String removeListenerLocally(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
protected void closeListeners()
public void countDownCompletionLatch(int id)
countDownCompletionLatch
in interface CacheSyncListenerCompleter
protected Integer registerCompletionLatch(int count)
protected void deregisterCompletionLatch(Integer countDownLatchId)
protected void waitCompletionLatch(Integer countDownLatchId)
protected void waitCompletionLatch(Integer countDownLatchId, int offset)
protected void ensureOpen()
public void close()
public void destroy()
public boolean isClosed()
protected String getDistributedObjectName()
protected String getServiceName()
protected ICacheService getService()
protected NodeEngine getNodeEngine()
protected void validateCacheLoader(javax.cache.integration.CompletionListener completionListener)
protected void closeCacheLoader()
protected void submitLoadAllTask(OperationFactory operationFactory, javax.cache.integration.CompletionListener completionListener)
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.