Package org.naviqore.utils.cache
Class ValueObjectCache<T>
java.lang.Object
org.naviqore.utils.cache.ValueObjectCache<T>
- Type Parameters:
T- the type of the value objects to be cached
A generic cache for immutable value objects.
The cache stores value objects of type T, ensuring that only one instance of each unique value is retained in memory.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ValueObjectCache
public ValueObjectCache()
-
-
Method Details
-
getOrAdd
Retrieves the value from the cache or adds it if it does not exist.- Parameters:
value- the value to be cached- Returns:
- the cached value
-
clear
public void clear()Clear the cache.
-