Package org.castor.cache
Class AbstractBaseCache
- java.lang.Object
-
- org.castor.cache.AbstractBaseCache
-
- All Implemented Interfaces:
java.util.Map<java.lang.Object,java.lang.Object>
,Cache
- Direct Known Subclasses:
AbstractDistributedCache
,AbstractHashbelt
,CountLimited
,EHCache
,JcsCache
,NoCache
,OsCache
,TimeLimited
,Unlimited
public abstract class AbstractBaseCache extends java.lang.Object implements Cache
Base implementation of all LRU cache types.- Since:
- 1.0
- Version:
- $Revision: 8102 $ $Date: 2006-05-05 13:53:54 -0600 (Fri, 05 May 2006) $
- Author:
- Werner Guttmann, Ralf Joachim
-
-
Field Summary
-
Fields inherited from interface org.castor.cache.Cache
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE
-
-
Constructor Summary
Constructors Constructor Description AbstractBaseCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Life-cycle method to allow custom resource cleanup for a cache implementation.void
expire(java.lang.Object key)
Remove the mapping identified by key from the cache.void
expireAll()
Removes all mappings from the cache.java.lang.String
getName()
Get virtual name of this cache.void
initialize(java.util.Properties params)
Lyfe-cycle method to allow custom initialization of cache implementations.protected java.lang.Object
invokeMethod(java.lang.Object target, java.lang.String name, java.lang.Class<?>[] types, java.lang.Object[] arguments)
Invoke method with given name and arguments having parameters of types specified on the given target.protected java.lang.Object
invokeStaticMethod(java.lang.Class<?> target, java.lang.String name, java.lang.Class<?>[] types, java.lang.Object[] arguments)
Invoke static method with given name and arguments having parameters of types specified on the given target.
-
-
-
Method Detail
-
initialize
public void initialize(java.util.Properties params) throws CacheAcquireException
Lyfe-cycle method to allow custom initialization of cache implementations.- Specified by:
initialize
in interfaceCache
- 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.
-
getName
public final java.lang.String getName()
Get virtual name of this cache. Castor sets the cache name to the class name of the objects stored in the cache.
-
expire
public final void expire(java.lang.Object key)
Remove the mapping identified by key from the cache.
-
expireAll
public final void expireAll()
Removes all mappings from the cache.
-
invokeStaticMethod
protected final java.lang.Object invokeStaticMethod(java.lang.Class<?> target, java.lang.String name, java.lang.Class<?>[] types, java.lang.Object[] arguments) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Invoke static method with given name and arguments having parameters of types specified on the given target.- Parameters:
target
- The target object to invoke the method on.name
- The name of the method to invoke.types
- The types of the parameters.arguments
- The parameters.- Returns:
- The result of the method invokation.
- Throws:
java.lang.NoSuchMethodException
- If a matching method is not found or if the name is "<init>"or "<clinit>".java.lang.IllegalAccessException
- If this Method object enforces Java language access control and the underlying method is inaccessible.java.lang.reflect.InvocationTargetException
- If the underlying method throws an exception.
-
invokeMethod
protected final java.lang.Object invokeMethod(java.lang.Object target, java.lang.String name, java.lang.Class<?>[] types, java.lang.Object[] arguments) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Invoke method with given name and arguments having parameters of types specified on the given target.- Parameters:
target
- The target object to invoke the method on.name
- The name of the method to invoke.types
- The types of the parameters.arguments
- The parameters.- Returns:
- The result of the method invokation.
- Throws:
java.lang.NoSuchMethodException
- If a matching method is not found or if the name is "<init>"or "<clinit>".java.lang.IllegalAccessException
- If this Method object enforces Java language access control and the underlying method is inaccessible.java.lang.reflect.InvocationTargetException
- If the underlying method throws an exception.
-
-