|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the type of key.V
- the type of value.public interface ICache<K,V>
This ICache
interface is the Cache
extension offered by
Hazelcast JCache.
In addition to the standard set of JCache methods defined in the JSR 107 specification, Hazelcast provides
additional operations to support a broader range of programing styles.
There are three different types of extensions methods provided:
ExpiryPolicy
parameter
to apply a special expiration to that specific operationsize()
) or typical Hazelcast-list additions
(e.g. destroy()
)
To take advantage of the methods of this interface, the Cache
instance needs to be
unwrapped as defined in the JSR 107 standard (Cache.unwrap(Class)
) by providing the
ICache
interface parameter.
ICache<Key , Value> unwrappedCache = cache.unwrap( ICache.class );The unwrapped cache instance can now be used for both ICache and Cache operations.
Asynchronous operations:
For most of the typical operations, Hazelcast provides asynchronous versions to program in a more reactive
styled way. All asynchronous operations follow the same naming pattern: the operation's name from JCache
extended by the term Async, e.g. the asynchronous version of Cache.get(Object)
is getAsync(Object)
.
These methods return an ICompletableFuture
that can be used to get the result by
implementing a callback based on ExecutionCallback
or wait for the operation to be
completed in a blocking fashion Future.get()
or
Future.get(long, java.util.concurrent.TimeUnit)
.
In a reactive way:
ICompletableFuture<Value> future = unwrappedCache.getAsync( "key-1" ) ; future.andThen( new ExecutionCallback() { public void onResponse( Value value ) { System.out.println( value ); } public void onFailure( Throwable throwable ) { throwable.printStackTrace(); } } );Or in a blocking way:
ICompletableFuture<Value> future = unwrappedCache.getAsync( "key-1" ) ; Value value = future.get(); System.out.println( value );
Custom ExpirePolicy:
Again for most of the typical operations, Hazelcast provides overloaded versions with an additional
ExpiryPolicy
parameter to configure a different expiration policy from the
default one set in the CompleteConfiguration
passed to the cache
creation. Therefore the Cache.put(Object, Object)
operation has an overload
put(Object, Object, javax.cache.expiry.ExpiryPolicy)
to pass in the
special policy.
Important to note: The overloads use an instance of ExpiryPolicy
and not
a Factory
instance as used in the configuration.
unwrappedCache.put( "key", "value", new AccessedExpiryPolicy( Duration.ONE_DAY ) );
Cache
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.cache.Cache |
---|
javax.cache.Cache.Entry<K,V> |
Method Summary | |
---|---|
void |
destroy()
Closes the cache. |
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,
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,
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 . |
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,
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. |
ICompletableFuture<V> |
getAsync(K key)
Asynchronously retrieves the mapped value of the given key using a custom ExpiryPolicy . |
ICompletableFuture<V> |
getAsync(K key,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Asynchronously gets an entry from cache using a custom ExpiryPolicy . |
CacheStatistics |
getLocalCacheStatistics()
|
boolean |
isDestroyed()
Determines whether this Cache instance has been destroyed. |
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,
javax.cache.expiry.ExpiryPolicy expiryPolicy)
Copies all of the entries from the given map to the cache using a custom ExpiryPolicy . |
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 ExpiryPolicy . |
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. |
ICompletableFuture<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. |
ICompletableFuture<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. |
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 the given key if and only if the currently mapped value equals to the value of oldValue. |
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,
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 . |
int |
size()
Total entry count. |
Methods inherited from interface javax.cache.Cache |
---|
clear, close, containsKey, deregisterCacheEntryListener, get, getAll, getAndPut, getAndRemove, getAndReplace, getCacheManager, getConfiguration, getName, invoke, invokeAll, isClosed, iterator, loadAll, put, putAll, putIfAbsent, registerCacheEntryListener, remove, remove, removeAll, removeAll, replace, replace, unwrap |
Method Detail |
---|
ICompletableFuture<V> getAsync(K key)
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 returned
NullPointerException
- if given key is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#get(K)
,
ICompletableFuture
ICompletableFuture<V> getAsync(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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 getAsync(Object)
NullPointerException
- if given key is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#get(K)
,
ICompletableFuture
ICompletableFuture<Void> putAsync(K key, V value)
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 key
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#put(K,V)
,
ICompletableFuture
ICompletableFuture<Void> putAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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 putAsync(Object, Object)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#put(K,V)
,
ICompletableFuture
ICompletableFuture<Boolean> putIfAbsentAsync(K key, V value)
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 key
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
ICompletableFuture<Boolean> putIfAbsentAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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
putIfAbsentAsync(Object, Object, javax.cache.expiry.ExpiryPolicy)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#putIfAbsent(K,V)
,
ICompletableFuture
ICompletableFuture<V> getAndPutAsync(K key, V value)
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 key
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
ICompletableFuture<V> getAndPutAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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 getAndPutAsync(Object, Object, javax.cache.expiry.ExpiryPolicy)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndPut(K,V)
,
ICompletableFuture
ICompletableFuture<Boolean> removeAsync(K key)
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
NullPointerException
- if given key is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#remove(K)
,
ICompletableFuture
ICompletableFuture<Boolean> removeAsync(K key, V oldValue)
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.
NullPointerException
- if given key or oldValue is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#remove(K,V)
,
ICompletableFuture
ICompletableFuture<V> getAndRemoveAsync(K key)
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
NullPointerException
- if given key is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndRemove(K)
,
ICompletableFuture
ICompletableFuture<Boolean> replaceAsync(K key, V 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 key
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#replace(K,V)
,
ICompletableFuture
ICompletableFuture<Boolean> replaceAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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 replaceAsync(Object, Object)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#replace(K,V)
,
ICompletableFuture
ICompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
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 key
NullPointerException
- if given key, oldValue or newValue is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
ICompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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 replaceAsync(Object, Object, Object)
NullPointerException
- if given key, oldValue or newValue is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#replace(K,V,V)
,
ICompletableFuture
ICompletableFuture<V> getAndReplaceAsync(K key, V 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 key
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
ICompletableFuture<V> getAndReplaceAsync(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndReplace(K,V)
,
ICompletableFuture
V get(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#get(K)
Map<K,V> getAll(Set<? extends K> keys, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given keys is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedCache.getAll(java.util.Set)
void put(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#put(K,V)
V getAndPut(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndPut(K,V)
void putAll(Map<? extends K,? extends V> map, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given map is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedCache.putAll(java.util.Map)
boolean putIfAbsent(K key, V value, javax.cache.expiry.ExpiryPolicy 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 Cache.putIfAbsent(Object, Object)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#putIfAbsent(K,V)
boolean replace(K key, V oldValue, V newValue, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key, oldValue or newValue is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#replace(K,V,V)
boolean replace(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key, oldValue or newValue is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#replace(K,V)
V getAndReplace(K key, V value, javax.cache.expiry.ExpiryPolicy expiryPolicy)
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)
NullPointerException
- if given key or value is null
javax.cache.CacheException
- if anything exceptional
happens while invoking the request, other exceptions are wrappedjavax.cache.Cache#getAndReplace(K,V)
int size()
void destroy()
CacheManager.destroyCache(String)
boolean isDestroyed()
true
if this Cache instance is destroyed; false
if it is still openCacheStatistics getLocalCacheStatistics()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |