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.
  • Field Summary

    Fields inherited from class org.apache.camel.support.LRUCacheFactory

    FACTORY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <K, V> Map<K,V>
    createLRUCache(int maximumCacheSize)
    Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.
    <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.
    <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.
    <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.
    <K, V> Map<K,V>
    createLRUSoftCache(int maximumCacheSize)
    Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.
    <K, V> Map<K,V>
    createLRUSoftCache(int initialCapacity, int maximumCacheSize)
    Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.
    <K, V> Map<K,V>
    createLRUSoftCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
    Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.
    <K, V> Map<K,V>
    createLRUWeakCache(int maximumCacheSize)
    Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.
    <K, V> Map<K,V>
    createLRUWeakCache(int initialCapacity, int maximumCacheSize)
    Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.
    <K, V> Map<K,V>
    createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
    Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public <K, V> Map<K,V> createLRUWeakCache(int maximumCacheSize)
      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

      public <K, V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize)
      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

      public <K, V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
      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.