## org.red5.server.api.cache
Interface ICacheStore

All Known Implementing Classes:
  CacheImpl, EhCacheImpl, NoCacheImpl

    public interface ICacheStore

Storage for cacheable objects. Selected cache engines must implement this interface.

Author:
  The Red5 Project (red5@osflash.org), Paul Gregoire (mondain@gmail.com)
See Also:
  Soft references provide for quick-and-dirty caching, Reference Objects and Garbage Collection, Top Ten New Things You Can Do with NIO, Proxy Cache Solution

Method Summary
`void` `destroy()` Allows for cleanup of a cache implementation.
`ICacheable` `get(String name)` Return a cached object with the given name.
`Iterator<String>` `getObjectNames()` Return iterator over the names of all already loaded objects in the storage.
`Iterator<SoftReference<? extends ICacheable>>` `getObjects()` 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(ICacheable obj)` Delete the passed cached object.
`boolean` `remove(String name)` Delete the cached object with the given name.
`void` `setMaxEntries(int max)` Sets the maximum number of entries for the cache.

Method Detail

### 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.

Copyright © 2006-2010 The Red5 Project