Package 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 intoEvictionPolicy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TaddMeta(T val)Adds a new metadata.booleanevict()Evicts entry associated with given key from cache.booleanisCached()Checks whether entry is currently present in cache or not.<T> Tmeta()Gets metadata added by eviction policy.<T> TputMetaIfAbsent(T val)Adds given metadata value only if it was absent.<T> TremoveMeta()Removes metadata by name.<T> booleanremoveMeta(T val)Removes metadata only if its current value is equal tovalpassed in.<T> booleanreplaceMeta(T curVal, T newVal)Replaces given metadata with newnewValvalue only if its current value is equal tocurVal.intsize()Returns entry size in bytes.
-
-
-
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:
Trueif entry could be evicted,falseotherwise.
-
isCached
boolean isCached()
Checks whether entry is currently present in cache or not. If entry is not in cache (e.g. has been removed)falseis returned. In this case all operations on this entry will cause creation of a new entry in cache.- Returns:
Trueif entry is in cache,falseotherwise.
-
size
int size()
Returns entry size in bytes.- Returns:
- entry size in bytes.
-
meta
@Nullable <T> T meta()
Gets metadata added by eviction policy.- Type Parameters:
T- Type of the metadata value.- Returns:
- Metadata value or
null.
-
addMeta
@Nullable <T> T addMeta(T val)
Adds a new metadata.- Type Parameters:
T- Type of the metadata value.- Parameters:
val- Metadata value.- Returns:
- Metadata previously added, or
nullif there was none.
-
putMetaIfAbsent
@Nullable <T> T putMetaIfAbsent(T val)
Adds given metadata value only if it was absent.- Type Parameters:
T- Type of the metadata value.- Parameters:
val- Value to add if it's not attached already.- Returns:
nullif new value was put, or current value if put didn't happen.
-
replaceMeta
<T> boolean replaceMeta(T curVal, T newVal)Replaces given metadata with newnewValvalue only if its current value is equal tocurVal. Otherwise, it is no-op.- Type Parameters:
T- Type of the metadata value.- Parameters:
curVal- Current value to check.newVal- New value.- Returns:
trueif replacement occurred,falseotherwise.
-
removeMeta
@Nullable <T> T removeMeta()
Removes metadata by name.- Type Parameters:
T- Type of the metadata value.- Returns:
- Value of removed metadata or
null.
-
removeMeta
<T> boolean removeMeta(T val)
Removes metadata only if its current value is equal tovalpassed in.- Type Parameters:
T- Type of the metadata value.- Parameters:
val- Value to compare.- Returns:
Trueif value was removed,falseotherwise.
-
-