K
- The type of the key to retrieve the cached objectV
- The type of the object to cachepublic class NonExpiringCache<K,V> extends Object
Allows the Caching of an object. The object will be retrieved from the cache, or calculated using a computation function then retrieved from the cache for future retrievals.
This cache implementation has no mechanism for evicting or expiring single entries and as such will continue to grow as new records are added. If the application is expected to have a large cache that is in need of expiry features, or per record eviction, it is better to use a more fully featured cache implementation such as the one provided by guava.
Constructor and Description |
---|
NonExpiringCache() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the cache.
|
V |
get(K key,
Function<K,V> valueCalculator)
Gets the object from the cache for the given key, or computes the value from calculation function and inserts
the calculated value into the map.
|
int |
size()
Gets the size of the cache.
|
public V get(K key, Function<K,V> valueCalculator)
key
- The key of the object to retrievevalueCalculator
- The function to calculate the value if the key is not in the cachepublic void clear()
public int size()
Copyright © 2010-2018, ForgeRock All Rights Reserved.