Interface ICacheAccess<K,V>
- All Superinterfaces:
ICacheAccessManagement
- All Known Implementing Classes:
CacheAccess
-
Method Summary
Modifier and TypeMethodDescriptionBasic get method.Basic get method.getCacheElement
(K name) This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.Map<K,
ICacheElement<K, V>> getCacheElements
(Set<K> names) Get multiple elements from the cache based on a set of cache keys.getElementAttributes
(K name) Gets the elementAttributes attribute of the ICacheAccess objectgetMatching
(String pattern) Retrieve matching objects from the cache region this instance provides access to.Map<K,
ICacheElement<K, V>> getMatchingCacheElements
(String pattern) Get multiple elements from the cache based on a set of cache keys.void
Puts and/or overrides an element with the name in that region.void
put
(K name, V obj, IElementAttributes attr) Description of the Methodvoid
Puts in cache if an item does not exist with the name in that region.void
Remove an object for this key if one exists, else do nothing.void
resetElementAttributes
(K name, IElementAttributes attributes) Reset the attributes on the object matching this key name.Methods inherited from interface org.apache.commons.jcs3.access.behavior.ICacheAccessManagement
clear, dispose, freeMemoryElements, getCacheAttributes, getDefaultElementAttributes, getStatistics, getStats, setCacheAttributes, setDefaultElementAttributes
-
Method Details
-
get
Basic get method.- Parameters:
name
-- Returns:
- Object or null if not found.
-
get
Basic get method. If the object cannot be found in the cache, it will be retrieved by calling the supplier and subsequently storing it in the cache.- Parameters:
name
-supplier
- supplier to be called if the value is not found- Returns:
- Object.
-
getMatching
Retrieve matching objects from the cache region this instance provides access to.- Parameters:
pattern
- - a key pattern for the objects stored- Returns:
- A map of key to values. These are stripped from the wrapper.
-
putSafe
Puts in cache if an item does not exist with the name in that region.- Parameters:
name
-obj
-- Throws:
CacheException
-
put
Puts and/or overrides an element with the name in that region.- Parameters:
name
-obj
-- Throws:
CacheException
-
put
Description of the Method- Parameters:
name
-obj
-attr
-- Throws:
CacheException
-
getCacheElement
This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.This returns a reference to the wrapper. Any modifications will be reflected in the cache. No defensive copy is made.
This method is most useful if you want to determine things such as the how long the element has been in the cache.
The last access time in the ElementAttributes should be current.
- Parameters:
name
- Key the object is stored as- Returns:
- The ICacheElement<K, V> if the object is found or null
-
getCacheElements
Get multiple elements from the cache based on a set of cache keys.This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.
This returns a reference to the wrapper. Any modifications will be reflected in the cache. No defensive copy is made.
This method is most useful if you want to determine things such as the how long the element has been in the cache.
The last access time in the ElementAttributes should be current.
- Parameters:
names
- set of Object cache keys- Returns:
- a map of Object key to ICacheElement<K, V> element, or empty map if none of the keys are present
-
getMatchingCacheElements
Get multiple elements from the cache based on a set of cache keys.This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.
This returns a reference to the wrapper. Any modifications will be reflected in the cache. No defensive copy is made.
This method is most useful if you want to determine things such as the how long the element has been in the cache.
The last access time in the ElementAttributes should be current.
- Parameters:
pattern
- key search pattern- Returns:
- a map of Object key to ICacheElement<K, V> element, or empty map if no keys match the pattern
-
remove
Remove an object for this key if one exists, else do nothing.- Parameters:
name
-- Throws:
CacheException
-
resetElementAttributes
Reset the attributes on the object matching this key name.- Parameters:
name
-attributes
-- Throws:
CacheException
-
getElementAttributes
Gets the elementAttributes attribute of the ICacheAccess object- Parameters:
name
-- Returns:
- The elementAttributes value
- Throws:
CacheException
-