public interface CacheEntry<K,V> extends javax.cache.Cache.Entry<K,V>
Cache.Entry
by providing additional entry related information.
To get an instance of CacheEntry
from Cache.Entry
use
Cache.Entry.unwrap(Class)
method by passing CacheEntry
class to it as the argument.
CacheEntry
is supported only for Cache.Entry
returned by one of the following methods:
Cache.invoke(Object, EntryProcessor, Object...)
Cache.invokeAll(Set, EntryProcessor, Object...)
IgniteCache
To get an instance of CacheEntry
directly use IgniteCache.getEntry(Object)
or
IgniteCache.getEntries(Set)
methods.
CacheEntry
is not supported for Cache.iterator()
because of performance reasons.
Cache.iterator()
loads entries from all the cluster nodes and to speed up the load additional
information, like entry's version, is ignored.
IgniteCachecache = grid(0).cache(null); CacheEntry entry1 = cache.invoke(100, new EntryProcessor >() { public CacheEntry process(MutableEntry entry, Object... arguments) throws EntryProcessorException { return entry.unwrap(CacheEntry.class); } }); // Cache entry for the given key may be updated at some point later. CacheEntry entry2 = cache.invoke(100, new EntryProcessor >() { public CacheEntry process(MutableEntry entry, Object... arguments) throws EntryProcessorException { return entry.unwrap(CacheEntry.class); } }); // Comparing entries' versions. if (entry1.version().compareTo(entry2.version()) < 0) { // the entry has been updated }
Modifier and Type | Method and Description |
---|---|
Comparable |
version()
Returns a comparable object representing the version of this cache entry.
|
Comparable version()
It is valid to compare cache entries' versions for the same key. In this case the latter update will be represented by a higher version. The result of versions comparison of cache entries of different keys is undefined.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024