Class AbstractBaseCache

java.lang.Object
org.castor.cache.AbstractBaseCache
All Implemented Interfaces:
Map<Object,Object>, Cache
Direct Known Subclasses:
AbstractDistributedCache, AbstractHashbelt, CountLimited, EHCache, JcsCache, NoCache, OsCache, TimeLimited, Unlimited

public abstract class AbstractBaseCache extends 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
  • Constructor Details

    • AbstractBaseCache

      public AbstractBaseCache()
  • Method Details

    • initialize

      public void initialize(Properties params) throws CacheAcquireException
      Lyfe-cycle method to allow custom initialization of cache implementations.
      Specified by:
      initialize in interface Cache
      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
    • 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
      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
      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
    • invokeStaticMethod

      protected final Object invokeStaticMethod(Class<?> target, String name, Class<?>[] types, Object[] arguments) throws NoSuchMethodException, IllegalAccessException, 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:
      NoSuchMethodException - If a matching method is not found or if the name is "<init>"or "<clinit>".
      IllegalAccessException - If this Method object enforces Java language access control and the underlying method is inaccessible.
      InvocationTargetException - If the underlying method throws an exception.
    • invokeMethod

      protected final Object invokeMethod(Object target, String name, Class<?>[] types, Object[] arguments) throws NoSuchMethodException, IllegalAccessException, 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:
      NoSuchMethodException - If a matching method is not found or if the name is "<init>"or "<clinit>".
      IllegalAccessException - If this Method object enforces Java language access control and the underlying method is inaccessible.
      InvocationTargetException - If the underlying method throws an exception.