|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.components.store.MRUMemoryStore
This class provides a cache algorithm for the requested documents. It combines a HashMap and a LinkedList to create a so called MRU (Most Recently Used) cache. The idea was taken from the "Writing Advanced Application Tutorial" from javasoft. Many thanx to the writers!
Fields inherited from interface org.apache.cocoon.components.store.Store |
PERSISTENT_CACHE, ROLE, TRANSIENT_CACHE |
Constructor Summary | |
MRUMemoryStore()
|
Method Summary | |
void |
compose(org.apache.avalon.framework.component.ComponentManager manager)
Get components of the ComponentManager |
boolean |
containsKey(java.lang.Object key)
Indicates if the given key is associated to a contained object. |
void |
dispose()
Dispose the component |
void |
free()
Frees some of the fast memory used by this store. |
java.lang.Object |
get(java.lang.Object key)
Get the object associated to the given unique key. |
void |
hold(java.lang.Object key,
java.lang.Object value)
This method holds the requested object in a HashMap combined with a LinkedList to create the MRU. |
java.util.Enumeration |
keys()
Returns the list of used keys as an Enumeration. |
void |
parameterize(org.apache.avalon.framework.parameters.Parameters params)
Initialize the MRUMemoryStore. |
void |
remove(java.lang.Object key)
Remove the object associated to the given key. |
int |
size()
Returns count of the objects in the store, or -1 if could not be obtained. |
void |
store(java.lang.Object key,
java.lang.Object value)
Store the given object in a persistent state. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MRUMemoryStore()
Method Detail |
public void compose(org.apache.avalon.framework.component.ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException
compose
in interface org.apache.avalon.framework.component.Composable
manager
- The ComponentManagerpublic void parameterize(org.apache.avalon.framework.parameters.Parameters params) throws org.apache.avalon.framework.parameters.ParameterException
parameterize
in interface org.apache.avalon.framework.parameters.Parameterizable
params
- Store parametersorg.apache.avalon.framework.parameters.ParameterException
- public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
public void store(java.lang.Object key, java.lang.Object value)
store
in interface Store
key
- The key for the object to storevalue
- The object to storepublic void hold(java.lang.Object key, java.lang.Object value)
hold
in interface Store
key
- The key of the object to be storedvalue
- The object to be storedpublic java.lang.Object get(java.lang.Object key)
get
in interface Store
key
- The key of the requested objectpublic void remove(java.lang.Object key)
remove
in interface Store
key
- The key of to be removed objectpublic boolean containsKey(java.lang.Object key)
containsKey
in interface Store
key
- The key of the objectpublic java.util.Enumeration keys()
keys
in interface Store
public int size()
size
in interface Store
public void free()
free
in interface Store
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |