Interface EvictionStrategy

All Known Implementing Classes:
AbstractEvictionStrategy, FIFOEvictionStrategy, LFUEvictionStrategy, LRUEvictionStrategy, NoneEvictionStrategy, SizeEvictionStrategy

@Deprecated public interface EvictionStrategy
Deprecated.
EvictionStrategy decides which entry to evict when the cache reaches its limits. The eviction strategy acts as a CacheEntry factory, this way if the cache has a new element inserted then the eviction strategy would be informed of such an operation and can keep track of the state of the cache. In order to keep track of the entries use the cache informs the eviction strategy on each use ("touch") of a CacheEntry.
Since:
5.0
Version:
1.0
Author:
Guy Korland
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Clear EvictionStrategy internal structures only and doesn't clear cache.
    createEntry(Object key, Object value, long ttl, int version)
    Deprecated.
    Creates new CacheEntry for the Cache and probably saves the entry in the internal structures.
    void
    Deprecated.
    Discard an Entry from the EvictionStrategy internal structures.
    int
    evict(Cache cache)
    Deprecated.
    Evicts batch of CacheEntry from the Cache according to the eviction strategy.
    void
    Deprecated.
    Informs the eviction strategy on a CacheEntry use.
  • Method Details

    • clear

      void clear()
      Deprecated.
      Clear EvictionStrategy internal structures only and doesn't clear cache.
    • createEntry

      CacheEntry createEntry(Object key, Object value, long ttl, int version)
      Deprecated.
      Creates new CacheEntry for the Cache and probably saves the entry in the internal structures.
      Parameters:
      key - the entry key
      value - the entry value
      ttl - the time to keep the entry in cache
      version - the entry version
      Returns:
      a CacheEntry that holds all the parameters and probably saved in the eviction strategy internal structures
    • discardEntry

      void discardEntry(CacheEntry entry)
      Deprecated.
      Discard an Entry from the EvictionStrategy internal structures.
      Parameters:
      entry - the entry to discard from the eviction strategy internal structures
    • evict

      int evict(Cache cache)
      Deprecated.
      Evicts batch of CacheEntry from the Cache according to the eviction strategy.
      Parameters:
      cache - the cache to be evicted
      Returns:
      the amount of entries evicted
    • touchEntry

      void touchEntry(CacheEntry entry)
      Deprecated.
      Informs the eviction strategy on a CacheEntry use.
      Parameters:
      entry - the touched entry