Interface ProductConfigurationCacheAccess<K,V>
- All Known Implementing Classes:
ProductConfigurationEHCacheAccessImpl
public interface ProductConfigurationCacheAccess<K,V>
The
ProductConfigurationCacheAccess provides the direct access to a cache region.-
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all elements from cache.Gets a value from the cache for the given key.getKeys()Provide the keys of all values, which are currently in the cache region.getWithLoader(K key, CacheValueLoader<V> loader) Gets a value from the cache using the loader to get the value.getWithSupplier(K key, Supplier<V> supplier) Gets a value from the cache for the given key.voidPuts a value into the cache region.voidputIfAbsent(K key, V value) Puts a value into the cache region, only if no value with same key already exists.voidRemoves a value from the cache.
-
Method Details
-
get
Gets a value from the cache for the given key.- Parameters:
key- K of object which should be retrieved from the cache- Returns:
- the value or
nullif the value could not be found in the cache
-
getKeys
Provide the keys of all values, which are currently in the cache region.- Returns:
- all keys.
-
getWithSupplier
Gets a value from the cache for the given key. If the value is not present in the cache the supplier will be called and the returned value will be cached.- Parameters:
key- key of valuesupplier- supplier which returns the value- Returns:
- the value
-
put
Puts a value into the cache region.- Parameters:
key- key of valuevalue- value which is put into the cache
-
putIfAbsent
Puts a value into the cache region, only if no value with same key already exists.- Parameters:
key- key of valuevalue- value which is put into the cache
-
remove
Removes a value from the cache. The cached value cannot be longer used.- Parameters:
key- the key of the value which has to be removed from the cache
-
getWithLoader
Gets a value from the cache using the loader to get the value.- Parameters:
key- the key of the value which has to loadedloader- the loader object which is used to load the value- Returns:
- number of objects currently stored in the cache.
-
clearCache
void clearCache()Removes all elements from cache.
-