Interface CacheEntry<K,V>
-
- All Superinterfaces:
javax.cache.Cache.Entry<K,V>
public interface CacheEntry<K,V> extends javax.cache.Cache.Entry<K,V>
Cache entry that extendsCache.Entry
by providing additional entry related information.To get an instance of
CacheEntry
fromCache.Entry
useCache.Entry.unwrap(Class)
method by passingCacheEntry
class to it as the argument.CacheEntry
is supported only forCache.Entry
returned by one of the following methods:Cache.invoke(Object, EntryProcessor, Object...)
Cache.invokeAll(Set, EntryProcessor, Object...)
- invoke and invokeAll methods of
IgniteCache
To get an instance of
CacheEntry
directly useIgniteCache.getEntry(Object)
orIgniteCache.getEntries(Set)
methods.CacheEntry
is not supported forCache.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.Java Example
IgniteCache<Integer, String> cache = grid(0).cache(null); CacheEntry<String, Integer> entry1 = cache.invoke(100, new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() { public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException { return entry.unwrap(CacheEntry.class); } }); // Cache entry for the given key may be updated at some point later. CacheEntry<String, Integer> entry2 = cache.invoke(100, new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() { public CacheEntry<String, Integer> process(MutableEntry<Integer, String> 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 }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Comparable
version()
Returns a comparable object representing the version of this cache entry.
-
-
-
Method Detail
-
version
Comparable version()
Returns a comparable object representing the version of this cache entry.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.
- Returns:
- Version of this cache entry.
-
-