org.castor.cache
Class AbstractBaseCache<K,V>
java.lang.Object
org.castor.cache.AbstractBaseCache<K,V>
- Type Parameters:
K - the type of keys maintained by this cacheV - the type of cached values
- All Implemented Interfaces:
- Map<K,V>, Cache<K,V>
- Direct Known Subclasses:
- AbstractDistributedCache, AbstractHashbelt, CountLimited, NoCache, TimeLimited, Unlimited
public abstract class AbstractBaseCache<K,V>
- extends Object
- implements Cache<K,V>
Base implementation of all cache types.
- Since:
- 1.0
- Version:
- $Revision: 9040 $ $Date: 2011-08-16 08:26:59 +0200 (Di, 16 Aug 2011) $
- Author:
- Werner Guttmann, Ralf Joachim
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
|
Method Summary |
void |
close()
Life-cycle method to allow custom resource cleanup for a cache implementation. |
void |
expire(Object key)
Remove the mapping identified by key from the cache. |
void |
expireAll()
Removes all mappings from the cache. |
String |
getName()
Get virtual name of this cache. |
void |
initialize(Properties params)
Lyfe-cycle method to allow custom initialization of cache implementations. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.castor.cache.Cache |
getType |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
AbstractBaseCache
public AbstractBaseCache()
initialize
public void initialize(Properties params)
throws CacheAcquireException
- Lyfe-cycle method to allow custom initialization of cache implementations.
- Specified by:
initialize in interface Cache<K,V>
- Parameters:
params - Parameters to initialize the cache (e.g. name, capacity).
- Throws:
CacheAcquireException - If cache can not be initialized.
close
public void close()
- Life-cycle method to allow custom resource cleanup for a cache implementation.
- Specified by:
close in interface Cache<K,V>
getName
public final String getName()
- Get virtual name of this cache. Castor sets the cache name to the class name of the
objects stored in the cache.
- Specified by:
getName in interface Cache<K,V>
- Returns:
- The cache name.
expire
public final void expire(Object key)
- Remove the mapping identified by key from the cache.
- Specified by:
expire in interface Cache<K,V>
- Parameters:
key - the key that needs to be removed.
expireAll
public final void expireAll()
- Removes all mappings from the cache.
- Specified by:
expireAll in interface Cache<K,V>
Copyright © 2012. All Rights Reserved.