Package uk.gov.gchq.gaffer.cache.impl
Class JcsCache<K,V>
- java.lang.Object
-
- uk.gov.gchq.gaffer.cache.impl.JcsCache<K,V>
-
- Type Parameters:
K
- The object type that acts as the key for the cacheV
- The value that is stored in the cache
- All Implemented Interfaces:
ICache<K,V>
public class JcsCache<K,V> extends Object implements ICache<K,V>
Implementation of theICache
interface, using a JCSGroupCacheAccess
object as the cache data store.
-
-
Constructor Summary
Constructors Constructor Description JcsCache(org.apache.commons.jcs.engine.control.CompositeCache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Remove all entries from the cache.V
get(K key)
Retrieve the value associated with the given key.Set<K>
getAllKeys()
Get all keys present in the cache.Collection<V>
getAllValues()
Get all values present in the cache.void
put(K key, V value)
Add a new key-value pair to the cache.void
remove(K key)
Remove the entry associated with the specified key.int
size()
Get the size of the cache.
-
-
-
Method Detail
-
get
public V get(K key)
Description copied from interface:ICache
Retrieve the value associated with the given key.
-
put
public void put(K key, V value) throws CacheOperationException
Description copied from interface:ICache
Add a new key-value pair to the cache.- Specified by:
put
in interfaceICache<K,V>
- Parameters:
key
- the key to addvalue
- the value to add- Throws:
CacheOperationException
- if there is an error adding the new key-value pair to the cache
-
remove
public void remove(K key)
Description copied from interface:ICache
Remove the entry associated with the specified key.
-
getAllValues
public Collection<V> getAllValues()
Description copied from interface:ICache
Get all values present in the cache.- Specified by:
getAllValues
in interfaceICache<K,V>
- Returns:
- a
Iterable
containing all of the cache values
-
getAllKeys
public Set<K> getAllKeys()
Description copied from interface:ICache
Get all keys present in the cache.- Specified by:
getAllKeys
in interfaceICache<K,V>
- Returns:
- a
Iterable
containing all of the cache keys
-
size
public int size()
Description copied from interface:ICache
Get the size of the cache.
-
clear
public void clear() throws CacheOperationException
Description copied from interface:ICache
Remove all entries from the cache.- Specified by:
clear
in interfaceICache<K,V>
- Throws:
CacheOperationException
- if there was an error clearing the cache
-
-