Class DefaultLRUCacheFactory

java.lang.Object
org.apache.camel.support.LRUCacheFactory
org.apache.camel.support.DefaultLRUCacheFactory

public class DefaultLRUCacheFactory extends LRUCacheFactory
Default LRUCacheFactory which uses a LinkedHashMap based implementation.
  • Constructor Details

    • DefaultLRUCacheFactory

      public DefaultLRUCacheFactory()
  • Method Details

    • createLRUCache

      public <K, V> Map<K,V> createLRUCache(int maximumCacheSize)
      Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUCache in class LRUCacheFactory
      Parameters:
      maximumCacheSize - the max capacity.
      Throws:
      IllegalArgumentException - if the initial capacity is negative
    • createLRUCache

      public <K, V> Map<K,V> createLRUCache(int maximumCacheSize, Consumer<V> onEvict)
      Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUCache in class LRUCacheFactory
      Parameters:
      maximumCacheSize - the max capacity.
      Throws:
      IllegalArgumentException - if the initial capacity is negative
    • createLRUCache

      public <K, V> Map<K,V> createLRUCache(int initialCapacity, int maximumCacheSize)
      Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUCache in class LRUCacheFactory
      Parameters:
      initialCapacity - the initial capacity.
      maximumCacheSize - the max capacity.
      Throws:
      IllegalArgumentException - if the initial capacity is negative
    • createLRUCache

      public <K, V> Map<K,V> createLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
      Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.
      Specified by:
      createLRUCache in class LRUCacheFactory
      Parameters:
      initialCapacity - the initial capacity.
      maximumCacheSize - the max capacity.
      stopOnEviction - whether to stop service on eviction.
      Throws:
      IllegalArgumentException - if the initial capacity is negative
    • createLRUSoftCache

      public <K, V> Map<K,V> createLRUSoftCache(int maximumCacheSize)
      Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUSoftCache in class LRUCacheFactory
      Parameters:
      maximumCacheSize - the max capacity.
      Throws:
      IllegalArgumentException - if the initial capacity is negative
    • createLRUSoftCache

      public <K, V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize)
      Description copied from class: LRUCacheFactory
      Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUSoftCache in class LRUCacheFactory
      Parameters:
      initialCapacity - the initial capacity.
      maximumCacheSize - the max capacity.
    • createLRUSoftCache

      public <K, V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
      Description copied from class: LRUCacheFactory
      Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUSoftCache in class LRUCacheFactory
      Parameters:
      initialCapacity - the initial capacity.
      maximumCacheSize - the max capacity.
      stopOnEviction - whether to stop service on eviction.
    • createLRUWeakCache

      @Deprecated public <K, V> Map<K,V> createLRUWeakCache(int maximumCacheSize)
      Deprecated.
      Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUWeakCache in class LRUCacheFactory
      Parameters:
      maximumCacheSize - the max capacity.
      Throws:
      IllegalArgumentException - if the initial capacity is negative
    • createLRUWeakCache

      @Deprecated public <K, V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize)
      Deprecated.
      Description copied from class: LRUCacheFactory
      Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUWeakCache in class LRUCacheFactory
      Parameters:
      initialCapacity - the initial capacity.
      maximumCacheSize - the max capacity.
    • createLRUWeakCache

      @Deprecated public <K, V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
      Deprecated.
      Description copied from class: LRUCacheFactory
      Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.
      Specified by:
      createLRUWeakCache in class LRUCacheFactory
      Parameters:
      initialCapacity - the initial capacity.
      maximumCacheSize - the max capacity.
      stopOnEviction - whether to stop service on eviction.