org.apache.ignite.cache

## 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 extends `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...)`
  - invoke and invokeAll methods of `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.

  ## Java Example

       IgniteCache cache = 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
       }

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Comparable` | `version()` Returns a comparable object representing the version of this cache entry.

    - ### Methods inherited from interface javax.cache.Cache.Entry

      `getKey, getValue, unwrap`

- - ### 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.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022