|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.store.impl.MRUMemoryStore
public class 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.
| Field Summary | |
|---|---|
private java.util.Hashtable |
m_cache
|
private org.apache.excalibur.instrument.CounterInstrument |
m_hitsInstrument
|
private java.lang.String |
m_instrumentableName
|
private org.apache.avalon.framework.service.ServiceManager |
m_manager
|
private int |
m_maxobjects
|
private org.apache.excalibur.instrument.CounterInstrument |
m_missesInstrument
|
private java.util.LinkedList |
m_mrulist
|
private boolean |
m_persistent
|
private Store |
m_persistentStore
|
private org.apache.excalibur.instrument.ValueInstrument |
m_sizeInstrument
|
private StoreJanitor |
m_storeJanitor
|
| Fields inherited from interface org.apache.excalibur.store.Store |
|---|
PERSISTENT_STORE, ROLE, TRANSIENT_STORE |
| Fields inherited from interface org.apache.excalibur.instrument.Instrumentable |
|---|
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY |
| Constructor Summary | |
|---|---|
MRUMemoryStore()
|
|
| Method Summary | |
|---|---|
private boolean |
checkSerializable(java.lang.Object object)
This method checks if an object is seriazable. |
void |
clear()
Clear the Store of all elements |
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. |
org.apache.excalibur.instrument.Instrumentable[] |
getChildInstrumentables()
|
java.lang.String |
getInstrumentableName()
|
org.apache.excalibur.instrument.Instrument[] |
getInstruments()
|
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. |
void |
service(org.apache.avalon.framework.service.ServiceManager manager)
Get components of the ComponentLocator |
void |
setInstrumentableName(java.lang.String name)
|
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.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String m_instrumentableName
private int m_maxobjects
private boolean m_persistent
private java.util.Hashtable m_cache
private java.util.LinkedList m_mrulist
private Store m_persistentStore
private StoreJanitor m_storeJanitor
private org.apache.avalon.framework.service.ServiceManager m_manager
private org.apache.excalibur.instrument.ValueInstrument m_sizeInstrument
private org.apache.excalibur.instrument.CounterInstrument m_hitsInstrument
private org.apache.excalibur.instrument.CounterInstrument m_missesInstrument
| Constructor Detail |
|---|
public MRUMemoryStore()
| Method Detail |
|---|
public void service(org.apache.avalon.framework.service.ServiceManager manager)
throws org.apache.avalon.framework.service.ServiceException
service in interface org.apache.avalon.framework.service.Serviceablemanager - The ComponentLocator
org.apache.avalon.framework.service.ServiceException
public void parameterize(org.apache.avalon.framework.parameters.Parameters params)
throws org.apache.avalon.framework.parameters.ParameterException
parameterize in interface org.apache.avalon.framework.parameters.Parameterizableparams - Store parameters
org.apache.avalon.framework.parameters.ParameterExceptionpublic 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 Storekey - The key for the object to storevalue - The object to store
public void hold(java.lang.Object key,
java.lang.Object value)
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 Storekey - The key of the requested object
public void remove(java.lang.Object key)
remove in interface Storekey - The key of to be removed objectpublic void clear()
clear in interface Storepublic boolean containsKey(java.lang.Object key)
containsKey in interface Storekey - The key of the object
public java.util.Enumeration keys()
keys in interface Storepublic int size()
size in interface Storepublic void free()
free in interface Storeprivate boolean checkSerializable(java.lang.Object object)
object - The object to be checked
public void setInstrumentableName(java.lang.String name)
setInstrumentableName in interface org.apache.excalibur.instrument.Instrumentablepublic java.lang.String getInstrumentableName()
getInstrumentableName in interface org.apache.excalibur.instrument.Instrumentablepublic org.apache.excalibur.instrument.Instrument[] getInstruments()
getInstruments in interface org.apache.excalibur.instrument.Instrumentablepublic org.apache.excalibur.instrument.Instrumentable[] getChildInstrumentables()
getChildInstrumentables in interface org.apache.excalibur.instrument.Instrumentable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||