Package uk.gov.gchq.gaffer.cache
Class Cache<K,V>
- java.lang.Object
-
- uk.gov.gchq.gaffer.cache.Cache<K,V>
-
- Type Parameters:
V- The type of values to add and get.
- Direct Known Subclasses:
FederatedStoreCacheTransient,JobTracker,NamedOperationCache,NamedViewCache
public class Cache<K,V> extends Object
Type safe cache, adding and getting is guaranteed to be same type.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Clear the cache.booleancontains(String graphId)voiddeleteFromCache(String key)Delete the value related to the specified ID from the cache.Iterable<K>getAllKeys()ICache<K,V>getCache()Get the cache.StringgetCacheName()static StringgetCacheNameFrom(String prefixCacheServiceName, String suffixCacheName)VgetFromCache(String key)Gets the requested value from the cacheStringgetSuffixCacheNameWithoutPrefix(String prefixCacheServiceName)
-
-
-
Method Detail
-
getFromCache
public V getFromCache(String key) throws CacheOperationException
Gets the requested value from the cache- Parameters:
key- Key to the value- Returns:
- The value associated with the key
- Throws:
CacheOperationException- if issue getting from cache
-
getCacheName
public String getCacheName()
-
clearCache
public void clearCache() throws CacheOperationExceptionClear the cache.- Throws:
CacheOperationException- if there was an error trying to clear the cache
-
contains
public boolean contains(String graphId)
-
deleteFromCache
public void deleteFromCache(String key)
Delete the value related to the specified ID from the cache.- Parameters:
key- the ID of the key to be deleted
-
getSuffixCacheNameWithoutPrefix
public String getSuffixCacheNameWithoutPrefix(String prefixCacheServiceName)
-
-