Interface ICacheStore

All Known Implementing Classes:
CacheImpl, NoCacheImpl

public interface ICacheStore
Storage for cacheable objects. Selected cache engines must implement this interface.
Author:
The Red5 Project, Paul Gregoire (mondain@gmail.com)
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Allows for cleanup of a cache implementation.
    get(String name)
    Return a cached object with the given name.
    Return iterator over the names of all already loaded objects in the storage.
    Return iterator over the already loaded objects in the storage.
    boolean
    offer(String name, Object obj)
    Offer an object to the cache with an associated key.
    void
    put(String name, Object obj)
    Puts an object in the cache with the associated key.
    boolean
    remove(String name)
    Delete the cached object with the given name.
    boolean
    Delete the passed cached object.
    void
    setMaxEntries(int max)
    Sets the maximum number of entries for the cache.
  • Method Details

    • offer

      boolean offer(String name, Object obj)
      Offer an object to the cache with an associated key. If the named object exists in cache, it will not be accepted.
      Parameters:
      name - string name representing the object
      obj - cacheable object
      Returns:
      true if accepted, false otherwise
    • put

      void put(String name, Object obj)
      Puts an object in the cache with the associated key.
      Parameters:
      name - string name representing the object
      obj - cacheable object
    • get

      ICacheable get(String name)
      Return a cached object with the given name.
      Parameters:
      name - the name of the object to return
      Returns:
      the object or null if no such object was found
    • remove

      boolean remove(ICacheable obj)
      Delete the passed cached object.
      Parameters:
      obj - the object to delete
      Returns:
      true if was removed; false it wasn't in cache to begin with
    • remove

      boolean remove(String name)
      Delete the cached object with the given name.
      Parameters:
      name - the name of the object to delete
      Returns:
      true if was removed; false it wasn't in cache to begin with
    • getObjectNames

      Iterator<String> getObjectNames()
      Return iterator over the names of all already loaded objects in the storage.
      Returns:
      iterator over all objects names
    • getObjects

      Iterator<SoftReference<? extends ICacheable>> getObjects()
      Return iterator over the already loaded objects in the storage.
      Returns:
      iterator over all objects
    • setMaxEntries

      void setMaxEntries(int max)
      Sets the maximum number of entries for the cache.
      Parameters:
      max - upper-limit of the cache
    • destroy

      void destroy()
      Allows for cleanup of a cache implementation.