public class CaffeineReferenceIdToKeyCacheImpl extends java.lang.Object implements ReferenceIdToKeyCache
Designed to be used as an reference in memory cache as a part of BaseTransformServiceImpl instances, such as ProductTransformService.
The cache is implemented by the caffeine library which implements a LRU based cache eviction strategy. It means unused id to key pairs will be evicted, also it stores max 10000 pairs to ensure the minimum memory consumption.
| Constructor and Description |
|---|
CaffeineReferenceIdToKeyCacheImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.String key,
java.lang.String value) |
void |
addAll(java.util.Map<java.lang.String,java.lang.String> idToKeyValues) |
void |
clearCache()
Discards all entries in the cache.
|
boolean |
containsKey(java.lang.String key) |
java.lang.String |
get(java.lang.String key) |
void |
remove(java.lang.String key) |
public void add(java.lang.String key,
java.lang.String value)
add in interface ReferenceIdToKeyCachekey - key with which the specified value is to be associated.value - value to be associated with the specified key.public void remove(java.lang.String key)
remove in interface ReferenceIdToKeyCachekey - key whose mapping is to be removed from the mappublic void addAll(java.util.Map<java.lang.String,java.lang.String> idToKeyValues)
addAll in interface ReferenceIdToKeyCacheidToKeyValues - mappings to be stored in this cache.public boolean containsKey(java.lang.String key)
containsKey in interface ReferenceIdToKeyCachekey - key whose presence in this map is to be testedpublic java.lang.String get(java.lang.String key)
get in interface ReferenceIdToKeyCachekey - the key whose associated value is to be returned.null if the cache contains
no mapping for the key.public void clearCache()
ReferenceIdToKeyCacheclearCache in interface ReferenceIdToKeyCache