public abstract class AbstractEvictionPolicy<K,V> extends Object implements EvictionPolicy<K,V>, Externalizable
Modifier and Type | Field and Description |
---|---|
protected LongAdder |
memSize
Memory size occupied by elements in container.
|
Constructor and Description |
---|
AbstractEvictionPolicy() |
Modifier and Type | Method and Description |
---|---|
int |
getBatchSize()
Gets batch size.
|
long |
getCurrentMemorySize()
Gets current queue size in bytes.
|
protected abstract int |
getCurrentSize() |
long |
getMaxMemorySize()
Gets maximum allowed cache size in bytes.
|
int |
getMaxSize()
Gets maximum allowed size of cache before entry will start getting evicted.
|
void |
onEntryAccessed(boolean rmv,
EvictableEntry<K,V> entry)
Callback for whenever entry is accessed.
|
void |
readExternal(ObjectInput in) |
protected abstract boolean |
removeMeta(Object meta) |
AbstractEvictionPolicy<K,V> |
setBatchSize(int batchSize)
Sets batch size.
|
AbstractEvictionPolicy<K,V> |
setMaxMemorySize(long maxMemSize)
Sets maximum allowed cache size in bytes.
|
AbstractEvictionPolicy<K,V> |
setMaxSize(int max)
Sets maximum allowed size of cache before entry will start getting evicted.
|
protected void |
shrink()
Shrinks backed container to maximum allowed size.
|
protected abstract int |
shrink0() |
protected abstract boolean |
touch(EvictableEntry<K,V> entry) |
void |
writeExternal(ObjectOutput out) |
protected final LongAdder memSize
protected void shrink()
public void onEntryAccessed(boolean rmv, EvictableEntry<K,V> entry)
onEntryAccessed
in interface EvictionPolicy<K,V>
rmv
- True
if entry has been removed, false
otherwise.entry
- Accessed entry.protected abstract int getCurrentSize()
protected abstract int shrink0()
protected abstract boolean removeMeta(Object meta)
meta
- Meta-information shipped to an entry.True
if meta was successfully removed from the container.protected abstract boolean touch(EvictableEntry<K,V> entry)
entry
- Entry to touch.True
if container has been changed by this call.public AbstractEvictionPolicy<K,V> setMaxMemorySize(long maxMemSize)
this
for chaining.public long getMaxMemorySize()
public long getCurrentMemorySize()
public AbstractEvictionPolicy<K,V> setMaxSize(int max)
max
- Maximum allowed size of cache before entry will start getting evicted.this
for chaining.public int getMaxSize()
public AbstractEvictionPolicy<K,V> setBatchSize(int batchSize)
batchSize
- Batch size.this
for chaining.public int getBatchSize()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024