K
- key typeV
- value typepublic class ClientCacheProxy<K,V> extends Object
Modifier and Type | Field and Description |
---|---|
protected CacheConfig<K,V> |
cacheConfig |
protected ClientContext |
clientContext |
protected ILogger |
logger |
protected String |
name |
protected String |
nameWithPrefix |
protected ClientNearCache<Data,Object> |
nearCache |
Constructor and Description |
---|
ClientCacheProxy(CacheConfig<K,V> cacheConfig,
ClientContext clientContext,
HazelcastClientCacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
protected void |
addListenerLocally(String regId,
javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
void |
clear() |
void |
close() |
protected void |
closeCacheLoader() |
protected void |
closeListeners() |
boolean |
containsKey(K key) |
protected void |
countDownCompletionLatch(int id) |
protected ICompletableFuture |
createCompletedFuture(Object value) |
protected EventHandler<Object> |
createHandler(CacheEventListenerAdaptor adaptor) |
void |
deregisterAllCacheEntryListener(Collection<String> listenerRegistrations) |
void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
protected void |
deregisterCompletionLatch(Integer countDownLatchId) |
protected void |
deregisterCompletionListener() |
void |
destroy() |
protected void |
ensureOpen() |
V |
get(K key) |
V |
get(K key,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Gets a key with custom expiry policy.
|
Map<K,V> |
getAll(Set<? extends K> keys) |
Map<K,V> |
getAll(Set<? extends K> keys,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
getAll operation with custom expiry policy.
|
V |
getAndPut(K key,
V value) |
V |
getAndPut(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
getAndPut operation with custom expiry policy.
|
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 expiry policy.
|
V |
getAndRemove(K key) |
ICompletableFuture<V> |
getAndRemoveAsync(K key)
Asynchronously removes the entry for a key returning the removed value if one existed.
|
V |
getAndReplace(K key,
V value) |
V |
getAndReplace(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
getAndReplace operation with custom expiry policy.
|
ICompletableFuture<V> |
getAndReplaceAsync(K key,
V value)
Asynchronously replaces the entry for a key only if it is currently mapped to some value.
|
ICompletableFuture<V> |
getAndReplaceAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously replaces the entry for a key only if it is currently mapped to some value
using custom expiry policy.
|
ICompletableFuture<V> |
getAsync(K key)
Asynchronously gets an entry from cache.
|
ICompletableFuture<V> |
getAsync(K key,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously gets an entry from cache with a provided expiry policy.
|
javax.cache.CacheManager |
getCacheManager() |
<C extends javax.cache.configuration.Configuration<K,V>> |
getConfiguration(Class<C> clazz) |
CacheStatistics |
getLocalCacheStatistics()
Directly access to local Cache Statistics.
|
String |
getName() |
String |
getNameWithPrefix() |
protected <T> T |
getSafely(Future<T> future) |
protected void |
invalidateNearCache(Data key) |
protected <T> T |
invoke(ClientRequest req) |
protected <T> ICompletableFuture<T> |
invoke(ClientRequest req,
Data keyData,
boolean completionOperation) |
<T> T |
invoke(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
<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)
put operation with custom expiry policy.
|
void |
putAll(Map<? extends K,? extends V> map) |
void |
putAll(Map<? extends K,? extends V> map,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
putAll operation with custom expiry policy.
|
ICompletableFuture<Void> |
putAsync(K key,
V value)
Asynchronously associates the specified value with the specified key in the cache.
|
ICompletableFuture<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 expiry policy.
|
protected <T> ICompletableFuture<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)
putIfAbsent operation with custom expiry policy.
|
ICompletableFuture<Boolean> |
putIfAbsentAsync(K key,
V value)
Asynchronously associates the specified value with the specified key in the cache if not already exist.
|
ICompletableFuture<Boolean> |
putIfAbsentAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously associates the specified value with the specified key in the cache if not already exist,
using a custom expiry policy.
|
protected ICompletableFuture<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) |
protected void |
registerCompletionListener() |
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,
boolean isRemoveAll) |
ICompletableFuture<Boolean> |
removeAsync(K key)
Asynchronously removes the mapping for a key from this cache if it is present.
|
ICompletableFuture<Boolean> |
removeAsync(K key,
V oldValue)
Asynchronously removes the mapping for a key only if it is currently mapped to the
given value.
|
protected <T> ICompletableFuture<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)
replace operation with custom expiry policy.
|
boolean |
replace(K key,
V oldValue,
V newValue) |
boolean |
replace(K key,
V oldValue,
V newValue,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
replace operation with custom expiry policy.
|
ICompletableFuture<Boolean> |
replaceAsync(K key,
V value)
Asynchronously replaces the entry for a key.
|
ICompletableFuture<Boolean> |
replaceAsync(K key,
V value,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously replaces the entry for a key only if it is currently mapped to some
value.
|
ICompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronously replaces the entry for a key only if it is currently mapped to a
given value.
|
ICompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously replaces the entry for a key only if it is currently mapped to a
given value using custom expiry policy.
|
protected <T> ICompletableFuture<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 |
storeInNearCache(Data key,
Data valueData,
V value) |
protected void |
submitLoadAllTask(CacheLoadAllRequest request,
javax.cache.integration.CompletionListener completionListener) |
protected Data |
toData(Object o) |
protected <T> T |
toObject(Object data) |
<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 ClientNearCache<Data,Object> nearCache
protected final ClientContext clientContext
protected final CacheConfig<K,V> cacheConfig
protected final String name
protected final String nameWithPrefix
public ClientCacheProxy(CacheConfig<K,V> cacheConfig, ClientContext clientContext, HazelcastClientCacheManager 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 ICompletableFuture<V> getAsync(K key)
ICache
getAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.javax.cache.Cache#get(K)
,
ICompletableFuture
public ICompletableFuture<V> getAsync(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
getAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#get(K)
,
ICompletableFuture
public ICompletableFuture<Void> putAsync(K key, V value)
ICache
putAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.value
- the value to be associated with the specified key.javax.cache.Cache#put(K,V)
,
ICompletableFuture
public ICompletableFuture<Void> putAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
putAsync
in interface ICache<K,V>
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.javax.cache.Cache#put(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> putIfAbsentAsync(K key, V value)
ICache
putIfAbsentAsync
in interface ICache<K,V>
key
- the key with which the specified value is to be associated.value
- the value to be associated with the specified key.javax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> putIfAbsentAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
putIfAbsentAsync
in interface ICache<K,V>
key
- the key with which the specified value is to be associated.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndPutAsync(K key, V value)
ICache
getAndPutAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.value
- the value to be associated with the specified key.javax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndPutAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
getAndPutAsync
in interface ICache<K,V>
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.javax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> removeAsync(K key)
ICache
removeAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.javax.cache.Cache#remove(K)
,
ICompletableFuture
public ICompletableFuture<Boolean> removeAsync(K key, V oldValue)
ICache
removeAsync
in interface ICache<K,V>
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
getAndRemoveAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.javax.cache.Cache#getAndRemove(K)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V value)
ICache
replaceAsync
in interface ICache<K,V>
key
- the key whose associated value is to be returned.value
- the value to be associated with the specified key.javax.cache.Cache#replace(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
replaceAsync
in interface ICache<K,V>
key
- the key with which the specified value is associated.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#replace(K,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
ICache
replaceAsync
in interface ICache<K,V>
key
- the key with which the specified value is associated.oldValue
- the value expected to be associated with the specified key.newValue
- the value to be associated with the specified key.javax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
public ICompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
replaceAsync
in interface ICache<K,V>
key
- the key with which the specified value is associated.oldValue
- the value expected to be associated with the specified key.newValue
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndReplaceAsync(K key, V value)
ICache
getAndReplaceAsync
in interface ICache<K,V>
key
- the key with which the specified value is associated.value
- the value to be associated with the specified key.javax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
public ICompletableFuture<V> getAndReplaceAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
getAndReplaceAsync
in interface ICache<K,V>
key
- the key with which the specified value is associated.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
public V get(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
get
in interface ICache<K,V>
key
- the key whose associated value is to be returned.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#get(K)
,
ICompletableFuture
public Map<K,V> getAll(Set<? extends K> keys, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
getAll
in interface ICache<K,V>
keys
- the keys whose associated values are to be returned.expiryPolicy
- custom expiry policy for this operation.Cache.getAll(java.util.Set)
,
ICompletableFuture
public void put(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
put
in interface ICache<K,V>
key
- the key with which the specified value is to be associated.value
- value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#put(K,V)
,
ICompletableFuture
public V getAndPut(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
getAndPut
in interface ICache<K,V>
key
- the key with which the specified value is to be associated.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
public void putAll(Map<? extends K,? extends V> map, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
putAll
in interface ICache<K,V>
map
- the mappings to be stored in this cache.expiryPolicy
- custom expiry policy for this operation.Cache.putAll(java.util.Map)
,
ICompletableFuture
public boolean putIfAbsent(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
putIfAbsent
in interface ICache<K,V>
key
- the key with which the specified value is to be associated.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
public boolean replace(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
replace
in interface ICache<K,V>
key
- the key with which the specified value is associated.oldValue
- the value expected to be associated with the specified key.newValue
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
public boolean replace(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
public V getAndReplace(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
ICache
getAndReplace
in interface ICache<K,V>
key
- the key with which the specified value is associated.value
- the value to be associated with the specified key.expiryPolicy
- custom expiry policy for this operation.javax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
public int size()
ICache
public CacheStatistics getLocalCacheStatistics()
ICache
getLocalCacheStatistics
in interface ICache<K,V>
protected <T> ICompletableFuture<T> invoke(ClientRequest req, Data keyData, boolean completionOperation)
protected <T> T getSafely(Future<T> future)
protected <T> ICompletableFuture<T> removeAsyncInternal(K key, V oldValue, boolean hasOldValue, boolean isGet, boolean withCompletionEvent)
protected <T> ICompletableFuture<T> replaceAsyncInternal(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy, boolean hasOldValue, boolean isGet, boolean withCompletionEvent)
protected <T> ICompletableFuture<T> putAsyncInternal(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy, boolean isGet, boolean withCompletionEvent)
protected ICompletableFuture<Boolean> putIfAbsentAsyncInternal(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy, boolean withCompletionEvent)
protected void removeAllInternal(Set<? extends K> keys, boolean isRemoveAll)
protected void invalidateNearCache(Data key)
protected void addListenerLocally(String regId, javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
protected String removeListenerLocally(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
public void deregisterAllCacheEntryListener(Collection<String> listenerRegistrations)
protected void closeListeners()
protected void countDownCompletionLatch(int id)
protected Integer registerCompletionLatch(int count)
protected void deregisterCompletionLatch(Integer countDownLatchId)
protected void waitCompletionLatch(Integer countDownLatchId)
protected void waitCompletionLatch(Integer countDownLatchId, int offset)
protected void registerCompletionListener()
protected void deregisterCompletionListener()
protected EventHandler<Object> createHandler(CacheEventListenerAdaptor adaptor)
protected ICompletableFuture createCompletedFuture(Object value)
protected void ensureOpen()
public void close()
public void destroy()
public boolean isClosed()
public String getNameWithPrefix()
protected <T> T toObject(Object data)
protected <T> T invoke(ClientRequest req)
protected void validateCacheLoader(javax.cache.integration.CompletionListener completionListener)
protected void closeCacheLoader()
protected void submitLoadAllTask(CacheLoadAllRequest request, javax.cache.integration.CompletionListener completionListener)
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.