Class AbstractBaseCache

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • 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.
      • 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, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Constructor Detail

      • AbstractBaseCache

        public AbstractBaseCache()
    • 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 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 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.
        Specified by:
        getName in interface Cache
        Returns:
        The cache name.
      • expire

        public final void expire​(java.lang.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 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.