Modifier and Type | Method and Description |
---|---|
public void | |
public void | |
public void | |
public Cacheable | |
public void | |
public boolean | |
public Cacheable | |
public Cacheable | |
public void | registerMBean(String
the unique name of the database to which the cache belongs dbName)Register an MBean that allows user to monitor this cache instance. |
public void | |
public void | |
public void | |
public void | useDaemonService(DaemonService
A daemon service daemon)This cache can use this DaemonService if it needs some work to be done in the background. |
public Collection | Returns: a Collection of all the elements in the cacheReturn a Collection of the Cacheables currently in the cache. |
ageOut | back to summary |
---|---|
public void ageOut() Age as many objects as possible out of the cache.
This call is guaranteed not to block.
It is not guaranteed to leave the cache empty.
|
clean | back to summary |
---|---|
public void clean(Matchable partialKey) throws StandardException Clean all objects that match the partialKey (or exact key). Any cached object that results in the partialKey.equals(Object) method returning true when passed the cached object will be cleaned. In order to clean more than one object the Cacheable equals method must be able to handle a partial key, e.g. a page has PageKey but a clean may pass a ContainerKey which will discard all pages in that container.
|
cleanAll | back to summary |
---|---|
public void cleanAll() throws StandardException Place all objects in their clean state by calling their clean method if they are dirty. This method guarantees that all objects that existed in the cache at the time of the call are placed in the clean state sometime during this call. Objects that are added to the cache during this call or objects that are dirtied during this call (by other callers) are not guaranteed to be clean once this call returns.
|
create | back to summary |
---|---|
public Cacheable create(Object key, Object createParameter) throws StandardException Create an object in the cache. The resulting object will match the key provided using the equals()
method, i.e. the return Cacheable will have getIdentifier.equals(key) true.
If an object that matches the key already exists in the cache then
an exception is thrown.
The returned object is kept, i.e. its identity will not change, until the release() method is called. The release() method must be called after the caller is finished with the object and throw away the reference to it, e.g. Page p = (Page) pageCache.create(pageKey, createType); // do stuff with p // release p pageCache.release(p); p = null;
|
deregisterMBean | back to summary |
---|---|
public void deregisterMBean() Deregister the MBean that monitors this cache. If there is no MBean for this instance, this is a no-op. |
discard | back to summary |
---|---|
public boolean discard(Matchable partialKey) Discard all objects that match the partialKey (or exact key). Any cached object that results in the partialKey.equals(Object) method returning true when passed the cached object will be thrown out of the cache if and only if it is not in use. The Cacheable will be discarded without its clean method being called. If partialKey is null, it matches all objects. This is a way to discard all objects from the cache in case of emergency shutdown. In order to discard more than one object the Cacheable equals method must be able to handle a partial key, e.g. a page has PageKey but a discard may pass a ContainerKey which will discard all pages in that container.
|
find | back to summary |
---|---|
public Cacheable find(Object key) throws StandardException Find an object in the cache. Find an object in the cache that matches the key provided using the equals() method, i.e. the return Cacheable will have getIdentifier.equals(key) true. If the object does not exist in the cache it will be added by one of:
The returned object is kept, i.e. its identity will not change, until the release() method is called. The release() method must be called after the caller is finished with the object and throw away the reference to it, e.g. Page p = (Page) pageCache.find(pageKey); // do stuff with p // release p pageCache.release(p); p = null;
|
findCached | back to summary |
---|---|
public Cacheable findCached(Object key) throws StandardException Find an object in the cache.
Find an object in the cache that matches the key provided using the equals()
method, i.e. the return Cacheable will have getIdentifier.equals(key) true.
If a matching object does not exist in the cache, null is returned.
Page p = (Page) pageCache.findCached(pageKey); if (p != null) { // do stuff with p // release p pageCache.release(p); p = null; }
|
registerMBean | back to summary |
---|---|
public void registerMBean(String dbName) throws StandardException Register an MBean that allows user to monitor this cache instance. This is a no-op if the platform does not support Java Management Extensions (JMX).
The MBean will be automatically deregistered when
|
release | back to summary |
---|---|
public void release(Cacheable entry) Release a
|
remove | back to summary |
---|---|
public void remove(Cacheable entry) throws StandardException Delete and remove an object from the cache. It is up to the user of the cache
to provide synchronization of some form that ensures that only one caller
executes remove() on a cached object.
|
shutdown | back to summary |
---|---|
public void shutdown() throws StandardException Shutdown the cache. This call stops the cache returning
any more valid references on a
|
useDaemonService | back to summary |
---|---|
public void useDaemonService(DaemonService daemon) This cache can use this DaemonService if it needs some work to be done in the background. The caller must ensure that it has exclusive access to the cache when this method is called. No synchronization is required in the implementations of this method.
|
values | back to summary |
---|---|
public Collection Return a Collection of the Cacheables currently in the cache. The Collection should be a copy so that external synchronization isn't required. This method should only be used for diagnostic purposes.
|