Class CaffeineReferenceIdToKeyCacheImpl
- java.lang.Object
 - 
- com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl
 
 
- 
- All Implemented Interfaces:
 ReferenceIdToKeyCache
public class CaffeineReferenceIdToKeyCacheImpl extends java.lang.Object implements ReferenceIdToKeyCache
A Caffeine cache to store reference id to key pairs.Designed to be used as an reference in memory cache as a part of
BaseTransformServiceImplinstances, such asProductTransformService.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 Summary
Constructors Constructor Description CaffeineReferenceIdToKeyCacheImpl() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String key, java.lang.String value)voidaddAll(java.util.Map<java.lang.String,java.lang.String> idToKeyValues)voidclearCache()Discards all entries in the cache.booleancontainsKey(java.lang.String key)java.lang.Stringget(java.lang.String key)voidremove(java.lang.String key) 
 - 
 
- 
- 
Method Detail
- 
add
public void add(java.lang.String key, java.lang.String value)- Specified by:
 addin interfaceReferenceIdToKeyCache- Parameters:
 key- key with which the specified value is to be associated.value- value to be associated with the specified key.
 
- 
remove
public void remove(java.lang.String key)
- Specified by:
 removein interfaceReferenceIdToKeyCache- Parameters:
 key- key whose mapping is to be removed from the map
 
- 
addAll
public void addAll(java.util.Map<java.lang.String,java.lang.String> idToKeyValues)
- Specified by:
 addAllin interfaceReferenceIdToKeyCache- Parameters:
 idToKeyValues- mappings to be stored in this cache.
 
- 
containsKey
public boolean containsKey(java.lang.String key)
- Specified by:
 containsKeyin interfaceReferenceIdToKeyCache- Parameters:
 key- key whose presence in this map is to be tested- Returns:
 - true if this map contains a mapping for the specified key in the cache.
 
 
- 
get
public java.lang.String get(java.lang.String key)
- Specified by:
 getin interfaceReferenceIdToKeyCache- Parameters:
 key- the key whose associated value is to be returned.- Returns:
 - the value to which the specified key is mapped, or 
nullif the cache contains no mapping for the key. 
 
- 
clearCache
public void clearCache()
Description copied from interface:ReferenceIdToKeyCacheDiscards all entries in the cache.- Specified by:
 clearCachein interfaceReferenceIdToKeyCache
 
 - 
 
 -