Class FifoEvictionPolicy<K,V>
- java.lang.Object
- 
- org.apache.ignite.cache.eviction.AbstractEvictionPolicy<K,V>
- 
- org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy<K,V>
 
 
- 
- All Implemented Interfaces:
- Externalizable,- Serializable,- EvictionPolicy<K,V>,- IgniteMBeanAware
 
 public class FifoEvictionPolicy<K,V> extends AbstractEvictionPolicy<K,V> implements IgniteMBeanAware Eviction policy based onFirst In First Out (FIFO)algorithm and supports batch eviction.The eviction starts in the following cases: - The cache size becomes batchSizeelements greater than the maximum size.
- The size of cache entries in bytes becomes greater than the maximum memory size. The size of cache entry calculates as sum of key size and value size.
 maxMemSize == 0).batchSizeelements will be evicted in this case. The defaultbatchSizevalue is1.This implementation is very efficient since it does not create any additional table-like data structures. The FIFOordering information is maintained by attaching ordering metadata to cache entries.- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from class org.apache.ignite.cache.eviction.AbstractEvictionPolicymemSize
 
- 
 - 
Constructor SummaryConstructors Constructor Description FifoEvictionPolicy()Constructs FIFO eviction policy with all defaults.FifoEvictionPolicy(int max)Constructs FIFO eviction policy with maximum size.FifoEvictionPolicy(int max, int batchSize)Constructs FIFO eviction policy with maximum size and given batch size.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCurrentSize()ObjectgetMBean()Collection<EvictableEntry<K,V>>queue()Gets read-only view on internalFIFOqueue in proper order.protected booleanremoveMeta(Object meta)FifoEvictionPolicy<K,V>setBatchSize(int batchSize)Sets batch size.FifoEvictionPolicy<K,V>setMaxMemorySize(long maxMemSize)Sets maximum allowed cache size in bytes.FifoEvictionPolicy<K,V>setMaxSize(int max)Sets maximum allowed size of cache before entry will start getting evicted.protected intshrink0()Tries to remove one item from queue.StringtoString()protected booleantouch(EvictableEntry<K,V> entry)- 
Methods inherited from class org.apache.ignite.cache.eviction.AbstractEvictionPolicygetBatchSize, getCurrentMemorySize, getMaxMemorySize, getMaxSize, onEntryAccessed, readExternal, shrink, writeExternal
 
- 
 
- 
- 
- 
Constructor Detail- 
FifoEvictionPolicypublic FifoEvictionPolicy() Constructs FIFO eviction policy with all defaults.
 - 
FifoEvictionPolicypublic FifoEvictionPolicy(int max) Constructs FIFO eviction policy with maximum size. Empty entries are allowed.- Parameters:
- max- Maximum allowed size of cache before entry will start getting evicted.
 
 - 
FifoEvictionPolicypublic FifoEvictionPolicy(int max, int batchSize)Constructs FIFO eviction policy with maximum size and given batch size. Empty entries are allowed.- Parameters:
- max- Maximum allowed size of cache before entry will start getting evicted.
- batchSize- Batch size.
 
 
- 
 - 
Method Detail- 
getCurrentSizepublic int getCurrentSize() - Specified by:
- getCurrentSizein class- AbstractEvictionPolicy<K,V>
- Returns:
- Size of the container with trackable entries.
 
 - 
setMaxMemorySizepublic FifoEvictionPolicy<K,V> setMaxMemorySize(long maxMemSize) Sets maximum allowed cache size in bytes.- Overrides:
- setMaxMemorySizein class- AbstractEvictionPolicy<K,V>
- Parameters:
- maxMemSize- Maximum allowed cache size in bytes.
- Returns:
- thisfor chaining.
 
 - 
setMaxSizepublic FifoEvictionPolicy<K,V> setMaxSize(int max) Sets maximum allowed size of cache before entry will start getting evicted.- Overrides:
- setMaxSizein class- AbstractEvictionPolicy<K,V>
- Parameters:
- max- Maximum allowed size of cache before entry will start getting evicted.
- Returns:
- thisfor chaining.
 
 - 
setBatchSizepublic FifoEvictionPolicy<K,V> setBatchSize(int batchSize) Sets batch size.- Overrides:
- setBatchSizein class- AbstractEvictionPolicy<K,V>
- Parameters:
- batchSize- Batch size.
- Returns:
- thisfor chaining.
 
 - 
queuepublic Collection<EvictableEntry<K,V>> queue() Gets read-only view on internalFIFOqueue in proper order.- Returns:
- Read-only view ono internal 'FIFO'queue.
 
 - 
removeMetaprotected boolean removeMeta(Object meta) - Specified by:
- removeMetain class- AbstractEvictionPolicy<K,V>
- Parameters:
- meta- Meta-information shipped to an entry.
- Returns:
- Trueif meta was successfully removed from the container.
 
 - 
touchprotected boolean touch(EvictableEntry<K,V> entry) - Specified by:
- touchin class- AbstractEvictionPolicy<K,V>
- Parameters:
- entry- Entry to touch.
- Returns:
- Trueif queue has been changed by this call.
 
 - 
shrink0protected int shrink0() Tries to remove one item from queue.- Specified by:
- shrink0in class- AbstractEvictionPolicy<K,V>
- Returns:
- number of bytes that was free. -1if queue is empty.
 
 - 
getMBeanpublic Object getMBean() - Specified by:
- getMBeanin interface- IgniteMBeanAware
- Returns:
- MBean for this object.
 
 
- 
 
-