| org.ofbiz.minerva.pool.cache.ObjectCache
All known Subclasses: org.ofbiz.minerva.pool.cache.LeastRecentlyUsedCache,
ObjectCache | public interface ObjectCache (Code) | | A caching map. This associates one or more values with a
key. When a value is requested for a key, a cached value
will be returned if available, and a new value will be
generated and cached otherwise. Instances of this interface
require a CachedObjectFactory to generate new values, and
control the caching in custom ways.
See Also: org.ofbiz.minerva.pool.cache.CachedObjectFactory author: Aaron Mulder ammulder@alumni.princeton.edu |
Field Summary | |
final public static int | UNLIMITED_SIZE When setting the size, this constant means there should
be no limit on the size of the cache. |
Method Summary | |
public void | close() Removes all cached objects and stops the cache. | public Object | getObject(Object key) Gets a cached object with the specified key. | public void | removeObjects(Object key) Removes all objects from the cache that have this key. | public void | returnObject(Object key, Object value) Returns an object to the cache that is currently in use
(checked out via useObject). | public void | setSize(int size) Sets the maximum number of objects in the cache. | public Object | useObject(Object key) Gets a cached object with the specified key. |
UNLIMITED_SIZE | final public static int UNLIMITED_SIZE(Code) | | When setting the size, this constant means there should
be no limit on the size of the cache. This is not
recommended under ordinary circumstances.
|
close | public void close()(Code) | | Removes all cached objects and stops the cache.
|
getObject | public Object getObject(Object key)(Code) | | Gets a cached object with the specified key. This is not
an exclusive function - any number of clients may get the
same object at the same time.
See Also: ObjectCache.useObject |
removeObjects | public void removeObjects(Object key)(Code) | | Removes all objects from the cache that have this key.
There will only be more than one object with the same
key if clients are using useObject and returnObject
instead of getObject.
|
returnObject | public void returnObject(Object key, Object value)(Code) | | Returns an object to the cache that is currently in use
(checked out via useObject). No other client can use
the same object until this method is called. The original
client may not continue to use the object after this
method is called.
See Also: ObjectCache.useObject |
setSize | public void setSize(int size)(Code) | | Sets the maximum number of objects in the cache. If the
number of objects is at the limit and a new object is
requested, other objects will be dropped from the cache.
|
useObject | public Object useObject(Object key)(Code) | | Gets a cached object with the specified key. This is an
exclusive function - no other client may get the same
object at the same time. You must return the object using
returnObject before another client may reuse this object.
See Also: ObjectCache.getObject See Also: ObjectCache.returnObject |
|
|