Package org.apache.fulcrum.cache
Interface GlobalCacheService
- 
- All Known Implementing Classes:
- DefaultGlobalCacheService,- EHCacheService,- JCSCacheService
 
 public interface GlobalCacheServiceGlobalCacheService interface.- Version:
- $Id: GlobalCacheService.java 1890075 2021-05-21 15:04:52Z painter $
- Author:
- Dave Bryson, Peter CourefreshableCachedObjectux
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> voidaddObject(String objectId, CachedObject<T> object)Adds an object to the cache.voidflushCache()Flush the cache of all objects.List<CachedObject<?>>getCachedObjects()Returns a copy of the non-expired CachedObjects in the cache as a list.intgetCacheSize()Returns the current size of the cache.List<String>getKeys()Returns a copy of keys to objects in the cache as a list.intgetNumberOfObjects()Returns the number of objects in the cache.<T> CachedObject<T>getObject(String objectId)Gets a cached object given its id (a String).voidremoveObject(String objectId)Removes an object from the cache.
 
- 
- 
- 
Field Detail- 
ROLEstatic final String ROLE Avalon role - used to id the component within the manager
 
- 
 - 
Method Detail- 
getObject<T> CachedObject<T> getObject(String objectId) throws ObjectExpiredException Gets a cached object given its id (a String).- Type Parameters:
- T- type of object to return
- Parameters:
- objectId- The String id for the object.
- Returns:
- A CachedObject.
- Throws:
- ObjectExpiredException- if the object has expired in the cache.
 
 - 
addObject<T> void addObject(String objectId, CachedObject<T> object) Adds an object to the cache.- Type Parameters:
- T- type of object to add
- Parameters:
- objectId- The String id for the object.
- object- The object to add to the cache.
 
 - 
removeObjectvoid removeObject(String objectId) Removes an object from the cache.- Parameters:
- objectId- The String id for the object.
 
 - 
getKeysList<String> getKeys() Returns a copy of keys to objects in the cache as a list. Note that keys to expired objects are not returned.- Returns:
- A List of String's representing the keys to objects in the cache.
 
 - 
getCachedObjectsList<CachedObject<?>> getCachedObjects() Returns a copy of the non-expired CachedObjects in the cache as a list.- Returns:
- A List of CachedObjectobjects held in the cache
 
 - 
getCacheSizeint getCacheSize() throws IOExceptionReturns the current size of the cache.- Returns:
- int representing current cache size in number of bytes
- Throws:
- IOException- if unable to return cache size
 
 - 
getNumberOfObjectsint getNumberOfObjects() Returns the number of objects in the cache.- Returns:
- int The current number of objects in the cache.
 
 - 
flushCachevoid flushCache() Flush the cache of all objects.
 
- 
 
-