org.apache.ignite.cache.eviction

## Interface EvictableEntry<K,V>

- All Superinterfaces:
    javax.cache.Cache.Entry<K,V>

      public interface EvictableEntry<K,V>
      extends javax.cache.Cache.Entry<K,V>

  Evictable cache entry passed into `EvictionPolicy`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `addMeta(T val)` Adds a new metadata.
    `boolean` | `evict()` Evicts entry associated with given key from cache.
    `boolean` | `isCached()` Checks whether entry is currently present in cache or not.
    `<T> T` | `meta()` Gets metadata added by eviction policy.
    `<T> T` | `putMetaIfAbsent(T val)` Adds given metadata value only if it was absent.
    `<T> T` | `removeMeta()` Removes metadata by name.
    `<T> boolean` | `removeMeta(T val)` Removes metadata only if its current value is equal to `val` passed in.
    `<T> boolean` | `replaceMeta(T curVal, T newVal)` Replaces given metadata with new `newVal` value only if its current value is equal to `curVal`.
    `int` | `size()` Returns entry size in bytes.

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

      `getKey, getValue, unwrap`

- - ### Method Detail

    - #### evict

          boolean evict()

      Evicts entry associated with given key from cache. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).
      Returns:
        `True` if entry could be evicted, `false` otherwise.

    - #### isCached

          boolean isCached()

      Checks whether entry is currently present in cache or not. If entry is not in cache (e.g. has been removed) `false` is returned. In this case all operations on this entry will cause creation of a new entry in cache.
      Returns:
        `True` if entry is in cache, `false` otherwise.

    - #### size

          int size()

      Returns entry size in bytes.
      Returns:
        entry size in bytes.

    - #### meta

          @Nullable
          <T> T meta()

      Gets metadata added by eviction policy.
      Returns:
        Metadata value or `null`.

    - #### addMeta

          @Nullable
          <T> T addMeta(T val)

      Adds a new metadata.
      Parameters:
        `val` - Metadata value.
      Returns:
        Metadata previously added, or `null` if there was none.

    - #### putMetaIfAbsent

          @Nullable
          <T> T putMetaIfAbsent(T val)

      Adds given metadata value only if it was absent.
      Parameters:
        `val` - Value to add if it's not attached already.
      Returns:
        `null` if new value was put, or current value if put didn't happen.

    - #### replaceMeta

          <T> boolean replaceMeta(T curVal,
                                  T newVal)

      Replaces given metadata with new `newVal` value only if its current value is equal to `curVal`. Otherwise, it is no-op.
      Parameters:
        `curVal` - Current value to check.
        `newVal` - New value.
      Returns:
        `true` if replacement occurred, `false` otherwise.

    - #### removeMeta

          @Nullable
          <T> T removeMeta()

      Removes metadata by name.
      Returns:
        Value of removed metadata or `null`.

    - #### removeMeta

          <T> boolean removeMeta(T val)

      Removes metadata only if its current value is equal to `val` passed in.
      Parameters:
        `val` - Value to compare.
      Returns:
        `True` if value was removed, `false` otherwise.

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020