org.apache.jcs.engine.memory.mru
Class MRUMemoryCache

java.lang.Object
  extended byorg.apache.jcs.engine.memory.AbstractMemoryCache
      extended byorg.apache.jcs.engine.memory.mru.MRUMemoryCache
All Implemented Interfaces:
MemoryCache, java.io.Serializable

public class MRUMemoryCache
extends AbstractMemoryCache

A SLOW AS HELL reference management system. The most recently used items move to the front of the list and get spooled to disk if the cache hub is configured to use a disk cache.

Version:
$Id: MRUMemoryCache.java,v 1.12 2003/08/22 11:57:19 mpoeschl Exp $
Author:
Aaron Smuts, James Taylor, John McNally
See Also:
Serialized Form

Field Summary
protected  int[] lockMe
          Description of the Field
private static org.apache.commons.logging.Log log
           
protected  java.util.LinkedList mrulist
          MRU list.
 
Fields inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache
attr, cache, cacheName, cattr, chunkSize, map, status
 
Constructor Summary
MRUMemoryCache()
           
 
Method Summary
 void dumpCacheEntries()
          Dump the cache entries from first to list for debugging.
 void dumpMap()
          Dump the cache map for debugging.
 ICacheElement get(java.io.Serializable key)
          Description of the Method
 java.lang.Object[] getKeyArray()
          Get an Array of the keys for all elements in the memory cache
 ICacheElement getQuiet(java.io.Serializable key)
          Get an item from the cache without affecting its last access time or position.
 void initialize(CompositeCache hub)
          For post reflection creation initialization
 boolean remove(java.io.Serializable key)
          Removes an item from the cache.
 void update(ICacheElement ce)
          Puts an item to the cache.
 
Methods inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache
dispose, getCacheAttributes, getCacheName, getCompositeCache, getGroupKeys, getIterator, getSize, getStats, getStatus, removeAll, setCacheAttributes, waterfal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

lockMe

protected int[] lockMe
Description of the Field


mrulist

protected java.util.LinkedList mrulist
MRU list.

Constructor Detail

MRUMemoryCache

public MRUMemoryCache()
Method Detail

initialize

public void initialize(CompositeCache hub)
For post reflection creation initialization

Specified by:
initialize in interface MemoryCache
Overrides:
initialize in class AbstractMemoryCache
Parameters:
hub -

update

public void update(ICacheElement ce)
            throws java.io.IOException
Puts an item to the cache.

Specified by:
update in interface MemoryCache
Specified by:
update in class AbstractMemoryCache
Parameters:
ce -
Throws:
java.io.IOException

getQuiet

public ICacheElement getQuiet(java.io.Serializable key)
                       throws java.io.IOException
Get an item from the cache without affecting its last access time or position.

Specified by:
getQuiet in interface MemoryCache
Specified by:
getQuiet in class AbstractMemoryCache
Parameters:
key - Identifies item to find
Returns:
Element mathinh key if found, or null
Throws:
java.io.IOException

get

public ICacheElement get(java.io.Serializable key)
                  throws java.io.IOException
Description of the Method

Specified by:
get in interface MemoryCache
Specified by:
get in class AbstractMemoryCache
Parameters:
key -
Returns:
Throws:
java.io.IOException

remove

public boolean remove(java.io.Serializable key)
               throws java.io.IOException
Removes an item from the cache.

Specified by:
remove in interface MemoryCache
Specified by:
remove in class AbstractMemoryCache
Parameters:
key -
Returns:
Throws:
java.io.IOException

getKeyArray

public java.lang.Object[] getKeyArray()
Get an Array of the keys for all elements in the memory cache

Specified by:
getKeyArray in interface MemoryCache
Specified by:
getKeyArray in class AbstractMemoryCache
Returns:
Object[]

dumpMap

public void dumpMap()
Dump the cache map for debugging.


dumpCacheEntries

public void dumpCacheEntries()
Dump the cache entries from first to list for debugging.