Class DefaultLRUCacheFactory

    • Constructor Detail

      • DefaultLRUCacheFactory

        public DefaultLRUCacheFactory()
    • Method Detail

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