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 void
clearCache()
Clear the cache.boolean
contains(String graphId)
void
deleteFromCache(String key)
Delete the value related to the specified ID from the cache.Iterable<K>
getAllKeys()
ICache<K,V>
getCache()
Get the cache.String
getCacheName()
static String
getCacheNameFrom(String prefixCacheServiceName, String suffixCacheName)
V
getFromCache(String key)
Gets the requested value from the cacheString
getSuffixCacheNameWithoutPrefix(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 CacheOperationException
Clear 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)
-
-