K - Key type.V - Value type.public interface GridCacheEntry<K,V> extends Map.Entry<K,V>, GridMetadataAware
'get(..)' methods to synchronously or asynchronously get values from cache.
All 'get(..)' methods are transactional and will participate in an ongoing transaction
if there is one.
'set(..)', 'setIfAbsent(..)', and 'replace(..)' methods to
synchronously or asynchronously put single or multiple entries into cache.
All these methods are transactional and will participate in an ongoing transaction
if there is one.
'remove(..)' methods to synchronously or asynchronously remove single or multiple keys
from cache. All 'remove(..)' methods are transactional and will participate in an ongoing transaction
if there is one.
'invalidate(..)' methods to set cached values to null.
'isLocked(..)' methods to check on distributed locks on a single or multiple keys
in cache. All locking methods are not transactional and will not enlist keys into ongoing transaction,
if any.
'peek(..)' methods to peek at values in global or transactional memory, swap
storage, or persistent storage.
'reload(..)' methods to reload latest values from persistent storage.
evict() to evict elements from cache, and optionally store
them in underlying swap storage for later access. All 'evict(..)' methods are not
transactional and will not enlist evicted keys into ongoing transaction, if any.
timeToLive(long) to change or lookup entry's time to live.
'x' provide the same functionality as their sibling
methods that don't end with 'x', however instead of returning a previous value they
return a boolean flag indicating whether operation succeeded or not. Returning
a previous value may involve a network trip or a persistent store lookup and should be
avoided whenever not needed.
'get(..)', 'put(..)', 'replace(..)',
and 'remove(..)' operations are transactional and will participate in an ongoing transaction.
Other methods like 'peek(..)' may be transaction-aware, i.e. check in-transaction entries first, but
will not affect the current state of transaction. See GridCacheTx documentation for more information
about transactions.| Modifier and Type | Method and Description |
|---|---|
boolean |
backup()
Gets the flag indicating if current node is backup for this entry.
|
boolean |
clear()
This method has the same semantic as
GridCacheProjection.clear(Object) method. |
boolean |
compact()
Optimizes the size of this entry.
|
boolean |
evict()
This method has the same semantic as
GridCacheProjection.evict(Object) method. |
long |
expirationTime()
Gets expiration time for this entry.
|
V |
get()
This method has the same semantic as
GridCacheProjection.get(Object) method. |
GridFuture<V> |
getAsync()
This method has the same semantic as
GridCacheProjection.getAsync(Object) method. |
V |
getValue()
This method has the same semantic as
get() method, however it
wraps GridException into GridRuntimeException if failed in order to
comply with Map.Entry interface. |
boolean |
isCached()
Checks whether entry is currently present in cache or not.
|
boolean |
isLocked()
This method has the same semantic as
GridCacheProjection.isLocked(Object) method. |
boolean |
isLockedByThread()
This method has the same semantic as
GridCacheProjection.isLockedByThread(Object) method. |
boolean |
lock(long timeout,
GridPredicate<GridCacheEntry<K,V>>... filter)
Synchronously acquires lock on a cached object associated with this entry
only if the passed in filter (if any) passes.
|
GridFuture<Boolean> |
lockAsync(long timeout,
GridPredicate<GridCacheEntry<K,V>>... filter)
Asynchronously acquires lock on a cached object associated with this entry
only if the passed in filter (if any) passes.
|
int |
memorySize()
Gets size of serialized key and value in addition to any overhead added by
GridGain itself. |
int |
partition()
Gets affinity partition id for this entry.
|
V |
peek()
This method has the same semantic as
GridCacheProjection.peek(Object) method. |
V |
peek(Collection<GridCachePeekMode> modes)
This method has the same semantic as
GridCacheProjection.peek(Object, Collection) method. |
boolean |
primary()
Gets the flag indicating current node's primary ownership for this entry.
|
GridCacheProjection<K,V> |
projection()
Cache projection to which this entry belongs.
|
V |
reload()
This method has the same semantic as
GridCacheProjection.reload(Object) method. |
GridFuture<V> |
reloadAsync()
This method has the same semantic as
GridCacheProjection.reloadAsync(Object) method. |
V |
remove(GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.remove(Object, GridPredicate[]) method. |
boolean |
remove(V val)
This method has the same semantic as
GridCacheProjection.remove(Object, Object) method. |
GridFuture<V> |
removeAsync(GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.removeAsync(Object, GridPredicate[]) method. |
GridFuture<Boolean> |
removeAsync(V val)
This method has the same semantic as
GridCacheProjection.removeAsync(Object, Object) method. |
boolean |
removex(GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.removex(Object, GridPredicate[]) method. |
GridFuture<Boolean> |
removexAsync(GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.removexAsync(Object, GridPredicate[]) method. |
V |
replace(V val)
This method has the same semantic as
GridCacheProjection.replace(Object, Object) method. |
boolean |
replace(V oldVal,
V newVal)
This method has the same semantic as
GridCacheProjection.replace(Object, Object, Object) method. |
GridFuture<V> |
replaceAsync(V val)
This method has the same semantic as
GridCacheProjection.replaceAsync(Object, Object) method. |
GridFuture<Boolean> |
replaceAsync(V oldVal,
V newVal)
This method has the same semantic as
GridCacheProjection.replaceAsync(Object, Object, Object) method. |
boolean |
replacex(V val)
This method has the same semantic as
GridCacheProjection.replacex(Object, Object) method. |
GridFuture<Boolean> |
replacexAsync(V val)
This method has the same semantic as
GridCacheProjection.replacexAsync(Object, Object) method. |
V |
set(V val,
GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.put(Object, Object, GridPredicate[]) method. |
GridFuture<V> |
setAsync(V val,
GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.putAsync(Object, Object, GridPredicate[]) method. |
V |
setIfAbsent(V val)
This method has the same semantic as
GridCacheProjection.putIfAbsent(Object, Object) method. |
GridFuture<V> |
setIfAbsentAsync(V val)
This method has the same semantic as
GridCacheProjection.putIfAbsentAsync(Object, Object) method. |
V |
setValue(V val)
This method has the same semantic as
set(Object, GridPredicate[]) method, however it
wraps GridException into GridRuntimeException if failed in order to
comply with Map.Entry interface. |
boolean |
setx(V val,
GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.putx(Object, Object, GridPredicate[]) method. |
GridFuture<Boolean> |
setxAsync(V val,
GridPredicate<GridCacheEntry<K,V>>... filter)
This method has the same semantic as
GridCacheProjection.putxAsync(Object, Object, GridPredicate[]) method. |
boolean |
setxIfAbsent(V val)
This method has the same semantic as
GridCacheProjection.putxIfAbsent(Object, Object) method. |
GridFuture<Boolean> |
setxIfAbsentAsync(V val)
This method has the same semantic as
GridCacheProjection.putxIfAbsentAsync(Object, Object) method. |
long |
timeToLive()
Gets time to live, i.e.
|
void |
timeToLive(long ttl)
Sets time to live, i.e.
|
void |
transform(GridClosure<V,V> transformer)
This method has the same semantic as
GridCacheProjection.transform(Object, GridClosure) method. |
GridFuture<?> |
transformAsync(GridClosure<V,V> transformer)
This method has the same semantic as
GridCacheProjection.transformAsync(Object, GridClosure) method. |
void |
unlock(GridPredicate<GridCacheEntry<K,V>>... filter)
Unlocks this entry only if current thread owns the lock.
|
Object |
version()
Gets current version of this cache entry.
|
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMetaGridCacheProjection<K,V> projection()
@Nullable V peek()
GridCacheProjection.peek(Object) method.GridCacheProjection.peek(Object).@Nullable V peek(@Nullable Collection<GridCachePeekMode> modes) throws GridException
GridCacheProjection.peek(Object, Collection) method.modes - See GridCacheProjection.peek(Object, Collection).GridCacheProjection.peek(Object, Collection).GridException - See GridCacheProjection.peek(Object, Collection).@Nullable V reload() throws GridException
GridCacheProjection.reload(Object) method.GridCacheProjection.reload(Object).GridException - See GridCacheProjection.reload(Object).GridFuture<V> reloadAsync()
GridCacheProjection.reloadAsync(Object) method.GridCacheProjection.reloadAsync(Object).boolean isLocked()
GridCacheProjection.isLocked(Object) method.GridCacheProjection.isLocked(Object).boolean isLockedByThread()
GridCacheProjection.isLockedByThread(Object) method.GridCacheProjection.isLockedByThread(Object).Object version()
long expirationTime()
long timeToLive()
void timeToLive(long ttl)
When called outside the transaction, this method will have no effect until the next update operation.
ttl - Time to live value for this entry.boolean primary()
Note, that this value is dynamic and may change with grid topology changes.
True if current grid node is the primary owner for this entry.boolean backup()
Note, that this value is dynamic and may change with grid topology changes.
True if current grid node is the backup for this entry.int partition()
@Nullable V getValue()
get() method, however it
wraps GridException into GridRuntimeException if failed in order to
comply with Map.Entry interface.@Nullable V get() throws GridException
GridCacheProjection.get(Object) method.GridCacheProjection.get(Object).GridException - See GridCacheProjection.get(Object).GridFuture<V> getAsync()
GridCacheProjection.getAsync(Object) method.GridCacheProjection.getAsync(Object).@Nullable V setValue(V val)
set(Object, GridPredicate[]) method, however it
wraps GridException into GridRuntimeException if failed in order to
comply with Map.Entry interface.setValue in interface Map.Entry<K,V>set(Object, GridPredicate[])@Nullable V set(V val, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheProjection.put(Object, Object, GridPredicate[]) method.val - See GridCacheProjection.put(Object, Object, GridPredicate[])filter - See GridCacheProjection.put(Object, Object, GridPredicate[]).GridCacheProjection.put(Object, Object, GridPredicate[]).GridException - See GridCacheProjection.put(Object, Object, GridPredicate[]).GridFuture<V> setAsync(V val, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheProjection.putAsync(Object, Object, GridPredicate[]) method.val - See GridCacheProjection.putAsync(Object, Object, GridPredicate[])filter - See GridCacheProjection.putAsync(Object, Object, GridPredicate[]).GridCacheProjection.putAsync(Object, Object, GridPredicate[]).@Nullable V setIfAbsent(V val) throws GridException
GridCacheProjection.putIfAbsent(Object, Object) method.val - See GridCacheProjection.putIfAbsent(Object, Object)GridCacheProjection.putIfAbsent(Object, Object).GridException - See GridCacheProjection.putIfAbsent(Object, Object).GridFuture<V> setIfAbsentAsync(V val)
GridCacheProjection.putIfAbsentAsync(Object, Object) method.val - See GridCacheProjection.putIfAbsentAsync(Object, Object)GridCacheProjection.putIfAbsentAsync(Object, Object).boolean setx(V val, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheProjection.putx(Object, Object, GridPredicate[]) method.val - See GridCacheProjection.putx(Object, Object, GridPredicate[])filter - See GridCacheProjection.putx(Object, Object, GridPredicate[]).GridCacheProjection.putx(Object, Object, GridPredicate[]).GridException - See GridCacheProjection.putx(Object, Object, GridPredicate[]).GridFuture<Boolean> setxAsync(V val, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheProjection.putxAsync(Object, Object, GridPredicate[]) method.val - See GridCacheProjection.putxAsync(Object, Object, GridPredicate[])filter - See GridCacheProjection.putxAsync(Object, Object, GridPredicate[]).GridCacheProjection.putxAsync(Object, Object, GridPredicate[]).boolean setxIfAbsent(@Nullable V val) throws GridException
GridCacheProjection.putxIfAbsent(Object, Object) method.val - See GridCacheProjection.putxIfAbsent(Object, Object)GridCacheProjection.putxIfAbsent(Object, Object).GridException - See GridCacheProjection.putxIfAbsent(Object, Object).GridFuture<Boolean> setxIfAbsentAsync(V val)
GridCacheProjection.putxIfAbsentAsync(Object, Object) method.val - See GridCacheProjection.putxIfAbsentAsync(Object, Object)GridCacheProjection.putxIfAbsentAsync(Object, Object).void transform(GridClosure<V,V> transformer) throws GridException
GridCacheProjection.transform(Object, GridClosure) method.transformer - Closure to be applied to the previous value in cache. If this closure returns
null, the associated value will be removed from cache.GridException - If cache update failed.GridCacheProjection.transform(Object, GridClosure)GridFuture<?> transformAsync(GridClosure<V,V> transformer)
GridCacheProjection.transformAsync(Object, GridClosure) method.transformer - Closure to be applied to the previous value in cache. If this closure returns
null, the associated value will be removed from cache.@Nullable V replace(V val) throws GridException
GridCacheProjection.replace(Object, Object) method.val - See GridCacheProjection.replace(Object, Object)GridCacheProjection.replace(Object, Object).GridException - See GridCacheProjection.replace(Object, Object).GridFuture<V> replaceAsync(V val)
GridCacheProjection.replaceAsync(Object, Object) method.val - See GridCacheProjection.replaceAsync(Object, Object)GridCacheProjection.replaceAsync(Object, Object).boolean replacex(V val) throws GridException
GridCacheProjection.replacex(Object, Object) method.val - See GridCacheProjection.replacex(Object, Object)GridCacheProjection.replacex(Object, Object).GridException - See GridCacheProjection.replacex(Object, Object).GridFuture<Boolean> replacexAsync(V val)
GridCacheProjection.replacexAsync(Object, Object) method.val - See GridCacheProjection.replacexAsync(Object, Object)GridCacheProjection.replacexAsync(Object, Object).boolean replace(V oldVal, V newVal) throws GridException
GridCacheProjection.replace(Object, Object, Object) method.oldVal - See GridCacheProjection.replace(Object, Object, Object)newVal - See GridCacheProjection.replace(Object, Object, Object)GridCacheProjection.replace(Object, Object).GridException - See GridCacheProjection.replace(Object, Object).GridFuture<Boolean> replaceAsync(V oldVal, V newVal)
GridCacheProjection.replaceAsync(Object, Object, Object) method.oldVal - See GridCacheProjection.replaceAsync(Object, Object, Object)newVal - See GridCacheProjection.replaceAsync(Object, Object, Object)GridCacheProjection.replaceAsync(Object, Object).@Nullable V remove(@Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheProjection.remove(Object, GridPredicate[]) method.filter - See GridCacheProjection.remove(Object, GridPredicate[]).GridCacheProjection.remove(Object, GridPredicate[]).GridException - See GridCacheProjection.remove(Object, GridPredicate[]).GridFuture<V> removeAsync(@Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheProjection.removeAsync(Object, GridPredicate[]) method.filter - See GridCacheProjection.removeAsync(Object, GridPredicate[]).GridCacheProjection.removeAsync(Object, GridPredicate[]).boolean removex(@Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheProjection.removex(Object, GridPredicate[]) method.filter - See GridCacheProjection.removex(Object, GridPredicate[]).GridCacheProjection.removex(Object, GridPredicate[]).GridException - See GridCacheProjection.removex(Object, GridPredicate[]).GridFuture<Boolean> removexAsync(@Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheProjection.removexAsync(Object, GridPredicate[]) method.filter - See GridCacheProjection.removexAsync(Object, GridPredicate[]).GridCacheProjection.removexAsync(Object, GridPredicate[]).boolean remove(V val) throws GridException
GridCacheProjection.remove(Object, Object) method.val - See GridCacheProjection.remove(Object, Object).GridCacheProjection.remove(Object, Object).GridException - See GridCacheProjection.remove(Object, Object).GridFuture<Boolean> removeAsync(V val)
GridCacheProjection.removeAsync(Object, Object) method.val - See GridCacheProjection.removeAsync(Object, Object).GridCacheProjection.removeAsync(Object, Object).boolean evict()
GridCacheProjection.evict(Object) method.GridCacheProjection.evict(Object).boolean clear()
GridCacheProjection.clear(Object) method.GridCacheProjection.clear(Object).boolean compact()
throws GridException
true if entry was cleared from cache (if value was null).GridException - If failed to compact.boolean lock(long timeout,
@Nullable
GridPredicate<GridCacheEntry<K,V>>... filter)
throws GridException
GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
GridCacheFlag.LOCAL, GridCacheFlag.READ.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration).filter - Optional filter to validate prior to acquiring the lock.True if all filters passed and lock was acquired,
false otherwise.GridException - If lock acquisition resulted in error.GridCacheFlagException - If flags validation failed.GridFuture<Boolean> lockAsync(long timeout, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
GridCacheFlag.LOCAL, GridCacheFlag.READ.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration).filter - Optional filter to validate prior to acquiring the lock.true
whenever all filters pass and locks are acquired before timeout is expired,
false otherwise.GridCacheFlagException - If flags validation failed.void unlock(GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
GridCacheFlag.LOCAL, GridCacheFlag.READ.filter - Optional filter that needs to pass prior to unlock taking effect.GridException - If unlock execution resulted in error.GridCacheFlagException - If flags validation failed.boolean isCached()
false is returned. In this case all
operations on this entry will cause creation of a new entry in cache.True if entry is in cache, false otherwise.int memorySize()
throws GridException
GridGain itself.GridException - If failed to evaluate entry size.Copyright © 2014. All rights reserved.