org.apache.lenya.util
Class CacheMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by java.util.HashMap
          extended by org.apache.lenya.util.CacheMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, org.apache.avalon.framework.logger.LogEnabled

public class CacheMap
extends java.util.HashMap
implements org.apache.avalon.framework.logger.LogEnabled

A map with a maximum capacity. When the map is full, the oldest entry is removed.

See Also:
Serialized Form

Constructor Summary
CacheMap(int _capacity, org.apache.avalon.framework.logger.Logger logger)
          Ctor.
 
Method Summary
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
           
 java.lang.Object get(java.lang.Object key)
           
protected  org.apache.avalon.framework.logger.Logger getLogger()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

CacheMap

public CacheMap(int _capacity,
                org.apache.avalon.framework.logger.Logger logger)
Ctor.

Parameters:
_capacity - The maximum number of entries.
logger - The logger.
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.HashMap
See Also:
Map.put(Object, Object)

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.HashMap
See Also:
Map.get(java.lang.Object)

getLogger

protected org.apache.avalon.framework.logger.Logger getLogger()

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled


Copyright 1999-2006 Apache Software Foundation. All Rights Reserved.