|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.components.store.impl.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. Adapted from org.apache.excalibur.store.impl.MRUMemoryStore
Field Summary | |
protected boolean |
persistent
|
Fields inherited from interface org.apache.excalibur.store.Store |
PERSISTENT_STORE, ROLE, TRANSIENT_STORE |
Constructor Summary | |
MRUMemoryStore()
|
Method Summary | |
void |
clear()
Clear the Store of all elements |
boolean |
containsKey(Object key)
Indicates if the given key is associated to a contained object. |
void |
destroy()
Dispose the component |
void |
free()
Frees some of the fast memory used by this store. |
Object |
get(Object key)
Get the object associated to the given unique key. |
Log |
getLogger()
|
void |
hold(Object key,
Object value)
This method holds the requested object in a HashMap combined with a LinkedList to create the MRU. |
void |
init()
Initialize the MRUMemoryStore. |
Enumeration |
keys()
Returns the list of used keys as an Enumeration. |
void |
remove(Object key)
Remove the object associated to the given key. |
void |
setLogger(Log l)
|
void |
setMaxObjects(int maxobjects)
Indicates how many objects will be held in the cache. |
void |
setPersistentStore(Store persistentStore)
Set to keep objects persisted after container shutdown |
void |
setStoreJanitor(StoreJanitor storeJanitor)
|
void |
setUsePersistentStore(boolean persistent)
|
int |
size()
Returns count of the objects in the store, or -1 if could not be obtained. |
void |
store(Object key,
Object value)
Store the given object in a persistent state. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean persistent
Constructor Detail |
public MRUMemoryStore()
Method Detail |
public Log getLogger()
public void setLogger(Log l)
public void setMaxObjects(int maxobjects)
maxobjects
- public void setUsePersistentStore(boolean persistent)
persistent
- public void setPersistentStore(Store persistentStore)
persistentStore
- public void setStoreJanitor(StoreJanitor storeJanitor)
storeJanitor
- public void init() throws Exception
Exception
ParameterException
public void destroy()
public void store(Object key, Object value)
store
in interface Store
key
- The key for the object to storevalue
- The object to storepublic void hold(Object key, Object value)
key
- The key of the object to be storedvalue
- The object to be storedpublic Object get(Object key)
get
in interface Store
key
- The key of the requested object
public void remove(Object key)
remove
in interface Store
key
- The key of to be removed objectpublic void clear()
clear
in interface Store
public boolean containsKey(Object key)
containsKey
in interface Store
key
- The key of the object
public 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |