| org.sakaiproject.memory.api.Cache
All known Subclasses: org.sakaiproject.memory.impl.MemCache,
Cache | public interface Cache extends Cacher(Code) | |
A Cache holds objects with keys with a limited lifespan.
When the object expires, the cache may call upon a CacheRefresher to update the key's value. The update is done in a separate thread.
|
Method Summary | |
void | attachDerivedCache(DerivedCache cache) Attach this DerivedCache to the cache. | void | clear() Clear all entries. | boolean | containsKey(Object key) Test for a non expired entry in the cache.
Parameters: key - The cache key. | boolean | containsKeyExpiredOrNot(Object key) Test for an entry in the cache - expired or not.
Parameters: key - The cache key. | void | destroy() Clear all entries and shudown the cache. | void | disable() Disable the cache. | boolean | disabled() | void | enable() Enable the cache. | void | expire(Object key) Expire this object. | Object | get(Object key) Get the non expired entry, or null if not there (or expired)
Parameters: key - The cache key. | List | getAll() Get all the non-expired non-null entries. | List | getAll(String path) Get all the non-expired non-null entries that are in the specified reference path. | Object | getExpiredOrNot(Object key) Get the entry, or null if not there (expired entries are returned, too).
Parameters: key - The cache key. | List | getIds() Get all the keys, modified from resource references to ids by removing the resource prefix. | List | getKeys() | void | holdEvents() Set the cache to hold events for later processing to assure an atomic "complete" load. | boolean | isComplete() | boolean | isComplete(String path) Are we complete for one level of the reference hierarchy?
Parameters: path - The reference to the completion level. | void | processEvents() Restore normal event processing in the cache, and process any held events now. | void | put(Object key, Object payload, int duration) | void | put(Object key, Object payload) Cache an object - don't automatically exipire it. | void | remove(Object key) Remove this entry from the cache. | void | setComplete() Set the cache to be complete, containing all possible entries. | void | setComplete(String path) Set the cache to be complete for one level of the reference hierarchy. |
attachDerivedCache | void attachDerivedCache(DerivedCache cache)(Code) | | Attach this DerivedCache to the cache. The DerivedCache is then notified of the cache contents changing events.
Parameters: cache - The DerivedCache to attach. |
clear | void clear()(Code) | | Clear all entries.
|
containsKey | boolean containsKey(Object key)(Code) | | Test for a non expired entry in the cache.
Parameters: key - The cache key. true if the key maps to a non-expired cache entry, false if not. |
containsKeyExpiredOrNot | boolean containsKeyExpiredOrNot(Object key)(Code) | | Test for an entry in the cache - expired or not.
Parameters: key - The cache key. true if the key maps to a cache entry, false if not. |
destroy | void destroy()(Code) | | Clear all entries and shudown the cache. Don't use after this call.
|
disable | void disable()(Code) | | Disable the cache.
|
disabled | boolean disabled()(Code) | | Is the cache disabled?
true if the cache is disabled, false if it is enabled. |
enable | void enable()(Code) | | Enable the cache.
|
expire | void expire(Object key)(Code) | | Expire this object.
Parameters: key - The cache key. |
get | Object get(Object key)(Code) | | Get the non expired entry, or null if not there (or expired)
Parameters: key - The cache key. The payload, or null if the payload is null, the key is not found, or the entry has expired (Note: use containsKey() to remove this ambiguity). |
getAll | List getAll()(Code) | | Get all the non-expired non-null entries.
all the non-expired non-null entries, or an empty list if none. |
getAll | List getAll(String path)(Code) | | Get all the non-expired non-null entries that are in the specified reference path. Note: only works with String keys.
Parameters: path - The reference path. all the non-expired non-null entries, or an empty list if none. |
getExpiredOrNot | Object getExpiredOrNot(Object key)(Code) | | Get the entry, or null if not there (expired entries are returned, too).
Parameters: key - The cache key. The payload, or null if the payload is null, the key is not found. (Note: use containsKey() to remove this ambiguity). |
getIds | List getIds()(Code) | | Get all the keys, modified from resource references to ids by removing the resource prefix. Note: only works with String keys.
The List of keys converted from references to ids (String). |
getKeys | List getKeys()(Code) | | Get all the keys
The List of key values (Object). |
holdEvents | void holdEvents()(Code) | | Set the cache to hold events for later processing to assure an atomic "complete" load.
|
isComplete | boolean isComplete()(Code) | | Are we complete?
true if we have all the possible entries cached, false if not. |
isComplete | boolean isComplete(String path)(Code) | | Are we complete for one level of the reference hierarchy?
Parameters: path - The reference to the completion level. true if we have all the possible entries cached, false if not. |
processEvents | void processEvents()(Code) | | Restore normal event processing in the cache, and process any held events now.
|
put | void put(Object key, Object payload, int duration)(Code) | | Cache an object
Parameters: key - The key with which to find the object. Parameters: payload - The object to cache. Parameters: duration - The time to cache the object (seconds). |
put | void put(Object key, Object payload)(Code) | | Cache an object - don't automatically exipire it.
Parameters: key - The key with which to find the object. Parameters: payload - The object to cache. Parameters: duration - The time to cache the object (seconds). |
remove | void remove(Object key)(Code) | | Remove this entry from the cache.
Parameters: key - The cache key. |
setComplete | void setComplete()(Code) | | Set the cache to be complete, containing all possible entries.
|
setComplete | void setComplete(String path)(Code) | | Set the cache to be complete for one level of the reference hierarchy.
Parameters: path - The reference to the completion level. |
|
|