org.apache.cocoon.components.store
Class MRUMemoryStore

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.store.MRUMemoryStore
All Implemented Interfaces:
Disposable, Component, Composable, LogEnabled, Parameterizable, ThreadSafe, Store

Deprecated. Use the Avalon Excalibur Store instead.

public final class MRUMemoryStore
extends AbstractLogEnabled
implements Store, Parameterizable, Composable, Disposable, ThreadSafe

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.

This implementation is based on MRUBucketMap - map with efficient O(1) implementation of MRU removal policy.

TODO: Port improvments to the Excalibur implementation

Version:
CVS $Id: MRUMemoryStore.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Gerhard Froehlich, Davanum Srinivas, Vadim Gritsenko

Field Summary
protected  MRUBucketMap cache
          Deprecated.  
 
Fields inherited from interface org.apache.cocoon.components.store.Store
PERSISTENT_CACHE, ROLE, TRANSIENT_CACHE
 
Constructor Summary
MRUMemoryStore()
          Deprecated.  
 
Method Summary
 void compose(ComponentManager manager)
          Deprecated. Get components of the ComponentManager
 boolean containsKey(Object key)
          Deprecated. Indicates if the given key is associated to a contained object.
 void dispose()
          Deprecated. Dispose the component
 void free()
          Deprecated. Frees some of the fast memory used by this store.
 Object get(Object key)
          Deprecated. Get the object associated to the given unique key.
 void hold(Object key, Object value)
          Deprecated. This method holds the requested object in a HashMap combined with a LinkedList to create the MRU.
 Enumeration keys()
          Deprecated. Returns the list of used keys as an Enumeration.
 void parameterize(Parameters params)
          Deprecated. Initialize the MRUMemoryStore.
 void remove(Object key)
          Deprecated. Remove the object associated to the given key.
 int size()
          Deprecated. Returns count of the objects in the store, or -1 if could not be obtained.
 void store(Object key, Object value)
          Deprecated. 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

cache

protected MRUBucketMap cache
Deprecated. 
Constructor Detail

MRUMemoryStore

public MRUMemoryStore()
Deprecated. 
Method Detail

compose

public void compose(ComponentManager manager)
             throws ComponentException
Deprecated. 
Get components of the ComponentManager

Specified by:
compose in interface Composable
Parameters:
manager - The ComponentManager
Throws:
ComponentException

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Deprecated. 
Initialize the MRUMemoryStore. A few options can be used:

Specified by:
parameterize in interface Parameterizable
Parameters:
params - Store parameters
Throws:
ParameterException

dispose

public void dispose()
Deprecated. 
Dispose the component

Specified by:
dispose in interface Disposable

store

public void store(Object key,
                  Object value)
Deprecated. 
Store the given object in a persistent state. It is up to the caller to ensure that the key has a persistent state across different JVM executions.

Specified by:
store in interface Store
Parameters:
key - The key for the object to store
value - The object to store

hold

public void hold(Object key,
                 Object value)
Deprecated. 
This method holds the requested object in a HashMap combined with a LinkedList to create the MRU. It also stores objects onto the filesystem if configured.

Specified by:
hold in interface Store
Parameters:
key - The key of the object to be stored
value - The object to be stored

get

public Object get(Object key)
Deprecated. 
Get the object associated to the given unique key.

Specified by:
get in interface Store
Parameters:
key - The key of the requested object
Returns:
the requested object

remove

public void remove(Object key)
Deprecated. 
Remove the object associated to the given key.

Specified by:
remove in interface Store
Parameters:
key - The key of to be removed object

containsKey

public boolean containsKey(Object key)
Deprecated. 
Indicates if the given key is associated to a contained object.

Specified by:
containsKey in interface Store
Parameters:
key - The key of the object
Returns:
true if the key exists

keys

public Enumeration keys()
Deprecated. 
Returns the list of used keys as an Enumeration.

Specified by:
keys in interface Store
Returns:
the enumeration of the cache

size

public int size()
Deprecated. 
Returns count of the objects in the store, or -1 if could not be obtained.

Specified by:
size in interface Store

free

public void free()
Deprecated. 
Frees some of the fast memory used by this store. It removes the last element in the store.

Specified by:
free in interface Store


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.