Package org.red5.cache
Interface ICacheStore
-
- All Known Implementing Classes:
CacheImpl,EhCacheImpl,NoCacheImpl
public interface ICacheStoreStorage for cacheable objects. Selected cache engines must implement this interface.- Author:
- The Red5 Project, 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddestroy()Allows for cleanup of a cache implementation.ICacheableget(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.booleanoffer(String name, Object obj)Offer an object to the cache with an associated key.voidput(String name, Object obj)Puts an object in the cache with the associated key.booleanremove(String name)Delete the cached object with the given name.booleanremove(ICacheable obj)Delete the passed cached object.voidsetMaxEntries(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 objectobj- 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 objectobj- 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
nullif 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.
-
-