Package org.apache.commons.jcs3.access
Class AbstractCacheAccess<K,V> 
java.lang.Object
org.apache.commons.jcs3.access.AbstractCacheAccess<K,V> 
- All Implemented Interfaces:
- ICacheAccessManagement
- Direct Known Subclasses:
- CacheAccess,- GroupCacheAccess
This class provides the common methods for all types of access to the cache.
 
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.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractCacheAccess(CompositeCache<K, V> cacheControl) Constructor for the CacheAccess object.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Removes all of the elements from a region.voiddispose()Dispose this region.intfreeMemoryElements(int numberToFree) This instructs the memory cache to remove the numberToFree according to its eviction policy.Gets the ICompositeCacheAttributes of the cache region.Retrieves A COPY OF the default element attributes used by this region.This returns the ICacheStats object with information on this region and its auxiliaries.getStats()voidSets the ICompositeCacheAttributes of the cache region.voidThis method is does not reset the attributes for items already in the cache.
- 
Constructor Details- 
AbstractCacheAccessConstructor for the CacheAccess object.- Parameters:
- cacheControl- The cache which the created instance accesses
 
 
- 
- 
Method Details- 
clearRemoves all of the elements from a region.- Specified by:
- clearin interface- ICacheAccessManagement
- Throws:
- CacheException
 
- 
setDefaultElementAttributesThis method is does not reset the attributes for items already in the cache. It could potentially do this for items in memory, and maybe on disk (which would be slow) but not remote items. Rather than have unpredictable behavior, this method just sets the default attributes. Items subsequently put into the cache will use these defaults if they do not specify specific attributes.- Specified by:
- setDefaultElementAttributesin interface- ICacheAccessManagement
- Parameters:
- attr- the default attributes.
- Throws:
- CacheException- if something goes wrong.
 
- 
getDefaultElementAttributesRetrieves A COPY OF the default element attributes used by this region. This does not provide a reference to the element attributes.Each time an element is added to the cache without element attributes, the default element attributes are cloned. - Specified by:
- getDefaultElementAttributesin interface- ICacheAccessManagement
- Returns:
- the default element attributes used by this region.
- Throws:
- CacheException
 
- 
getStatisticsThis returns the ICacheStats object with information on this region and its auxiliaries.This data can be formatted as needed. - Specified by:
- getStatisticsin interface- ICacheAccessManagement
- Returns:
- ICacheStats
 
- 
getStats- Specified by:
- getStatsin interface- ICacheAccessManagement
- Returns:
- A String version of the stats.
 
- 
disposeDispose this region. Flushes objects to and closes auxiliary caches. This is a shutdown command!To simply remove all elements from the region use clear(). - Specified by:
- disposein interface- ICacheAccessManagement
 
- 
getCacheAttributesGets the ICompositeCacheAttributes of the cache region.- Specified by:
- getCacheAttributesin interface- ICacheAccessManagement
- Returns:
- ICompositeCacheAttributes, the controllers config info, defined in the top section of a region definition.
 
- 
setCacheAttributesSets the ICompositeCacheAttributes of the cache region.- Specified by:
- setCacheAttributesin interface- ICacheAccessManagement
- Parameters:
- cattr- The new ICompositeCacheAttribute value
 
- 
freeMemoryElementsThis instructs the memory cache to remove the numberToFree according to its eviction policy. For example, the LRUMemoryCache will remove the numberToFree least recently used items. These will be spooled to disk if a disk auxiliary is available.- Specified by:
- freeMemoryElementsin interface- ICacheAccessManagement
- Parameters:
- numberToFree-
- Returns:
- the number that were removed. if you ask to free 5, but there are only 3, you will get 3.
- Throws:
- CacheException
 
- 
getCacheControl
 
-