public abstract class AbstractCacheAccess<K,V> extends Object implements ICacheAccessManagement
An instance of this class is tied to a specific cache region. Static methods are provided to get such instances.
Using this class you can retrieve an item, the item's wrapper, and the element's configuration. You can also put an item in the cache, remove an item, and clear a region.
The JCS class is the preferred way to access these methods.
Modifier | Constructor and Description |
---|---|
protected |
AbstractCacheAccess(CompositeCache<K,V> cacheControl)
Constructor for the CacheAccess object.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the elements from a region.
|
void |
dispose()
Dispose this region.
|
int |
freeMemoryElements(int numberToFree)
This instructs the memory cache to remove the numberToFree according to its eviction
policy.
|
ICompositeCacheAttributes |
getCacheAttributes()
Gets the ICompositeCacheAttributes of the cache region.
|
CompositeCache<K,V> |
getCacheControl() |
IElementAttributes |
getDefaultElementAttributes()
Retrieves A COPY OF the default element attributes used by this region.
|
ICacheStats |
getStatistics()
This returns the ICacheStats object with information on this region and its auxiliaries.
|
String |
getStats() |
void |
setCacheAttributes(ICompositeCacheAttributes cattr)
Sets the ICompositeCacheAttributes of the cache region.
|
void |
setDefaultElementAttributes(IElementAttributes attr)
This method is does not reset the attributes for items already in the cache.
|
protected AbstractCacheAccess(CompositeCache<K,V> cacheControl)
cacheControl
- The cache which the created instance accessespublic void clear() throws CacheException
clear
in interface ICacheAccessManagement
CacheException
public void setDefaultElementAttributes(IElementAttributes attr) throws CacheException
setDefaultElementAttributes
in interface ICacheAccessManagement
attr
- the default attributes.CacheException
- if something goes wrong.public IElementAttributes getDefaultElementAttributes() throws CacheException
Each time an element is added to the cache without element attributes, the default element attributes are cloned.
getDefaultElementAttributes
in interface ICacheAccessManagement
CacheException
public ICacheStats getStatistics()
This data can be formatted as needed.
getStatistics
in interface ICacheAccessManagement
public String getStats()
getStats
in interface ICacheAccessManagement
public void dispose()
To simply remove all elements from the region use clear().
dispose
in interface ICacheAccessManagement
public ICompositeCacheAttributes getCacheAttributes()
getCacheAttributes
in interface ICacheAccessManagement
public void setCacheAttributes(ICompositeCacheAttributes cattr)
setCacheAttributes
in interface ICacheAccessManagement
cattr
- The new ICompositeCacheAttribute valuepublic int freeMemoryElements(int numberToFree) throws CacheException
freeMemoryElements
in interface ICacheAccessManagement
numberToFree
- CacheException
public CompositeCache<K,V> getCacheControl()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.