Package org.red5.cache
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 TypeMethodDescriptionvoid
destroy()
Allows for cleanup of a cache implementation.Return a cached object with the given name.Return iterator over the names of all already loaded objects in the storage.Iterator<SoftReference<? extends ICacheable>>
Return iterator over the already loaded objects in the storage.boolean
Offer an object to the cache with an associated key.void
Puts an object in the cache with the associated key.boolean
Delete the cached object with the given name.boolean
remove
(ICacheable obj) Delete the passed cached object.void
setMaxEntries
(int max) Sets the maximum number of entries for the cache.
-
Method Details
-
offer
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
Puts an object in the cache with the associated key.- Parameters:
name
- string name representing the objectobj
- cacheable object
-
get
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
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
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
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.
-