Package org.apache.juneau.internal
Class Cache<K,V>
java.lang.Object
org.apache.juneau.internal.Cache<K,V>
- Type Parameters:
K
- The key type.V
- The value type.
Simple in-memory cache of objects.
Essentially just a wrapper around a ConcurrentHashMap.
See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Cache
Constructor- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
of
Static creator.- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
key
- The key type.type
- The value type.- Returns:
- A new builder for this object.
-
get
Retrieves the value with the specified key from this cache.- Parameters:
key
- The key.supplier
- The supplier for creating this object if it's not found in the cache.- Returns:
- The value.
-