Package 

Interface DDPartialKeyCache


  • 
    public interface DDPartialKeyCache<K, V>
    
                        

    Cache that can work on parts of a key to look up a value.

    An example would be looking up values from a substring of a string instead of first creating a string to do the lookup.

    • Method Detail

      • computeIfAbsent

         abstract V computeIfAbsent(K key, int m, int n, DDPartialKeyCache.Hasher<K> hasher, DDPartialKeyCache.Comparator<K, V> comparator, DDPartialKeyCache.Producer<K, out V> producer)

        Look up or create and store a value in the cache.

        Parameters:
        key - the key to look up
        m - extra parameter that is passed along with the key
        n - extra parameter that is passed along with the key
        hasher - how to compute the hash using key, m, and n
        comparator - how to compare the key, m, n, and value
        producer - how to create a cached value base on the key, m, and n if the lookup fails
      • clear

         abstract void clear()

        Clear the cache.