K
- The object type that acts as the key for the cacheV
- The value that is stored in the cachepublic class JcsCache<K,V> extends Object implements ICache<K,V>
ICache
interface, using a JCS GroupCacheAccess
object as the cache data store.Constructor and Description |
---|
JcsCache(org.apache.commons.jcs.engine.control.CompositeCache cache) |
Modifier and Type | Method and 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.
|
public JcsCache(org.apache.commons.jcs.engine.control.CompositeCache cache) throws org.apache.commons.jcs.access.exception.CacheException
org.apache.commons.jcs.access.exception.CacheException
public V get(K key)
ICache
public void put(K key, V value) throws CacheOperationException
ICache
put
in interface ICache<K,V>
key
- the key to addvalue
- the value to addCacheOperationException
- if there is an error adding the new key-value pair to the cachepublic void remove(K key)
ICache
public Collection<V> getAllValues()
ICache
getAllValues
in interface ICache<K,V>
Collection
containing all of the cache valuespublic Set<K> getAllKeys()
ICache
getAllKeys
in interface ICache<K,V>
Set
containing all of the cache keyspublic int size()
ICache
public void clear() throws CacheOperationException
ICache
clear
in interface ICache<K,V>
CacheOperationException
- if there was an error clearing the cacheCopyright © 2022. All rights reserved.