|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Method Summary | |
void |
ageOut()
Age as many objects as possible out of the cache. |
void |
clean(Matchable partialKey)
Clean all objects that match the partialKey (or exact key). |
void |
cleanAll()
Place all objects in their clean state by calling their clean method if they are dirty. |
boolean |
containsKey(java.lang.Object key)
Determine whether a key is in the cache. |
Cacheable |
create(java.lang.Object key,
java.lang.Object createParameter)
Create an object in the cache. |
boolean |
discard(Matchable partialKey)
Discard all objects that match the partialKey (or exact key). |
Cacheable |
find(java.lang.Object key)
Find an object in the cache. |
Cacheable |
findCached(java.lang.Object key)
Find an object in the cache. |
long[] |
getCacheStats()
Return statistics about cache that may be implemented. |
long |
getMaximumSize()
|
int |
getNumberInUse()
Report the number of items in use (with Identity) in this cache. |
void |
release(Cacheable entry)
Release a Cacheable object previously found with find() or findCached(). |
void |
remove(Cacheable entry)
Delete and remove an object from the cache. |
void |
resetCacheStats()
reset the cache statistics to 0. |
void |
resize(long newSize)
Change the maximum size of the cache. |
void |
scan(Matchable filter,
Operator operator)
Perform an operation on (approximately) all entries that matches the filter, or all entries if the filter is null. |
void |
setUsed(java.lang.Object[] keys)
Mark a set of entries as having been used. |
void |
shutdown()
Shutdown the cache. |
void |
useDaemonService(DaemonService daemon)
This cache can use this DaemonService if it needs some work to be done int he background |
Method Detail |
public long getMaximumSize()
public void resize(long newSize) throws StandardException
newSize
- the new maximum cache size
StandardException
- Cloudscape Standard error policypublic Cacheable find(java.lang.Object key) throws StandardException
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:
Page p = (Page) pageCache.find(pageKey); // do stuff with p // release p pageCache.release(p); p = null;
StandardException
- Standard Cloudscape error policy.Cacheable.setIdentity(java.lang.Object)
public Cacheable findCached(java.lang.Object key) throws StandardException
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.
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.findCached(pageKey); if (p != null) { // do stuff with p // release p pageCache.release(p); p = null; }
StandardException
- Standard Cloudscape error policy.public boolean containsKey(java.lang.Object key)
public void setUsed(java.lang.Object[] keys)
keys
- the key of the used entry.public Cacheable create(java.lang.Object key, java.lang.Object createParameter) throws StandardException
Page p = (Page) pageCache.create(pageKey, createType); // do stuff with p // release p pageCache.release(p); p = null;
StandardException
- Standard Cloudscape error policy.Cacheable.createIdentity(java.lang.Object, java.lang.Object)
public void release(Cacheable entry)
public void remove(Cacheable entry) throws StandardException
StandardException
- Standard Cloudscape error policy.public void cleanAll() throws StandardException
StandardException
- Standard Cloudscape error policy.Cacheable.clean(boolean)
,
Cacheable.isDirty()
public void clean(Matchable partialKey) throws StandardException
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.
StandardException
- Standard Cloudscape error policy.public void ageOut()
Cacheable.clean(boolean)
,
Cacheable.clearIdentity()
public void shutdown() throws StandardException
StandardException
- Standard Cloudscape error policy.public void useDaemonService(DaemonService daemon)
public boolean discard(Matchable partialKey)
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.
public int getNumberInUse()
public long[] getCacheStats()
public void resetCacheStats()
public void scan(Matchable filter, Operator operator)
filter
- operator
-
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |