Class FifoEvictionPolicyFactory<K,​V>

  • All Implemented Interfaces:
    Serializable, javax.cache.configuration.Factory<FifoEvictionPolicy<K,​V>>

    public class FifoEvictionPolicyFactory<K,​V>
    extends AbstractEvictionPolicyFactory<FifoEvictionPolicy<K,​V>>
    Factory class for FifoEvictionPolicy. Creates cache Eviction policy based on First In First Out (FIFO) algorithm and supports batch eviction.

    The eviction starts in the following cases:

    • The cache size becomes batchSize elements 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.
    Note:Batch eviction is enabled only if maximum memory limit isn't set (maxMemSize == 0). batchSize elements will be evicted in this case. The default batchSize value is 1.

    FifoEvictionPolicy implementation is very efficient since it does not create any additional table-like data structures. The FIFO ordering information is maintained by attaching ordering metadata to cache entries.

    See Also:
    Serialized Form
    • Constructor Detail

      • FifoEvictionPolicyFactory

        public FifoEvictionPolicyFactory()
        Constructor.
      • FifoEvictionPolicyFactory

        public FifoEvictionPolicyFactory​(int maxSize)
        Constructor.
        Parameters:
        maxSize - Maximum allowed size of cache before entry will start getting evicted.
      • FifoEvictionPolicyFactory

        public FifoEvictionPolicyFactory​(int maxSize,
                                         int batchSize,
                                         long maxMemSize)
        Parameters:
        maxSize - Maximum allowed size of cache before entry will start getting evicted.
        batchSize - Batch size.
        maxMemSize - Sets maximum allowed cache size in bytes.