Class TwoKeyConcurrentCache<K1,K2,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.concurrent.ConcurrentHashMap<org.apache.juneau.internal.TwoKeyConcurrentCache.Key<K1,K2>,V>
org.apache.juneau.internal.TwoKeyConcurrentCache<K1,K2,V>
Type Parameters:
K1 - Key part 1 type.
K2 - Key part 2 type.
V - Value type.
All Implemented Interfaces:
Serializable, ConcurrentMap<org.apache.juneau.internal.TwoKeyConcurrentCache.Key<K1,K2>,V>, Map<org.apache.juneau.internal.TwoKeyConcurrentCache.Key<K1,K2>,V>

public class TwoKeyConcurrentCache<K1,K2,V> extends ConcurrentHashMap<org.apache.juneau.internal.TwoKeyConcurrentCache.Key<K1,K2>,V>
A hashmap that allows for two-part keys.
See Also:
  • Constructor Details

    • TwoKeyConcurrentCache

      Constructor.
    • TwoKeyConcurrentCache

      public TwoKeyConcurrentCache(boolean disabled, BiFunction<K1,K2,V> supplier)
      Constructor.
      Parameters:
      disabled - If true, get/put operations are no-ops.
      supplier - The supplier for this cache.
  • Method Details

    • put

      public V put(K1 key1, K2 key2, V value)
      Adds an entry to this map.
      Parameters:
      key1 - Key part 1. Can be null.
      key2 - Key part 2. Can be null.
      value - Value.
      Returns:
      The previous value if there was one.
    • get

      public V get(K1 key1, K2 key2)
      Retrieves an entry from this map.
      Parameters:
      key1 - Key part 1. Can be null.
      key2 - Key part 2. Can be null.
      Returns:
      The previous value if there was one.