Interface ObjectCache

  • All Known Implementing Classes:
    CacheMap, WeakCacheMap

    public interface ObjectCache
    Interface Helma object cache classes need to implement.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean clear()
      Removes all items currently stored in the cache.
      boolean containsKey​(java.lang.Object key)
      Returns true if the collection contains an element for the key.
      int containsKeys​(java.lang.Object[] keys)
      Returns the number of keys in object array keys that were not found in the Map.
      java.lang.Object get​(java.lang.Object key)
      Gets the object associated with the specified key in the hashtable.
      java.lang.Object[] getCachedObjects()
      Return an array with all objects currently contained in the cache.
      java.util.Map<java.lang.String,​java.lang.Object> getStatistics()
      Returns a map of statistics about the cache
      void init​(Application app)
      Set the Application instance for the cache.
      java.lang.Object put​(java.lang.Object key, java.lang.Object value)
      Puts the specified element into the hashtable, using the specified key.
      java.lang.Object remove​(java.lang.Object key)
      Removes the element corresponding to the key.
      void shutdown()
      Called when the application holding the cache is stopped.
      int size()
      Return the number of objects currently stored in the cache.
      void updateProperties​(java.util.Properties props)
      Called when the application's properties have been updated to let the cache implementation update its settings.
    • Method Detail

      • init

        void init​(Application app)
        Set the Application instance for the cache.
        Parameters:
        app - the app instance
      • shutdown

        void shutdown()
        Called when the application holding the cache is stopped.
      • updateProperties

        void updateProperties​(java.util.Properties props)
        Called when the application's properties have been updated to let the cache implementation update its settings.
        Parameters:
        props -
      • containsKey

        boolean containsKey​(java.lang.Object key)
        Returns true if the collection contains an element for the key.
        Parameters:
        key - the key that we are looking for
      • containsKeys

        int containsKeys​(java.lang.Object[] keys)
        Returns the number of keys in object array keys that were not found in the Map. Those keys that are contained in the Map are nulled out in the array.
        Parameters:
        keys - an array of key objects we are looking for
        See Also:
        containsKey(java.lang.Object)
      • get

        java.lang.Object get​(java.lang.Object key)
        Gets the object associated with the specified key in the hashtable.
        Parameters:
        key - the specified key
        Returns:
        the element for the key or null if the key is not defined in the hash table.
        See Also:
        put(java.lang.Object, java.lang.Object)
      • put

        java.lang.Object put​(java.lang.Object key,
                             java.lang.Object value)
        Puts the specified element into the hashtable, using the specified key. The element may be retrieved by doing a get() with the same key. The key and the element cannot be null.
        Parameters:
        key - the specified key in the hashtable
        value - the specified element
        Returns:
        the old value of the key, or null if it did not have one.
        Throws:
        java.lang.NullPointerException - If the value of the element is equal to null.
        See Also:
        get(java.lang.Object)
      • remove

        java.lang.Object remove​(java.lang.Object key)
        Removes the element corresponding to the key. Does nothing if the key is not present.
        Parameters:
        key - the key that needs to be removed
        Returns:
        the value of key, or null if the key was not found.
      • clear

        boolean clear()
        Removes all items currently stored in the cache.
        Returns:
        true if the operation succeeded
      • size

        int size()
        Return the number of objects currently stored in the cache.
        Returns:
        the number of cached items
      • getCachedObjects

        java.lang.Object[] getCachedObjects()
        Return an array with all objects currently contained in the cache.
      • getStatistics

        java.util.Map<java.lang.String,​java.lang.Object> getStatistics()
        Returns a map of statistics about the cache