org.eclipse.actf.util.httpproxy.util
Class CacheMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<String,Object>
          extended by org.eclipse.actf.util.httpproxy.util.CacheMap
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>, SortedMap<String,Object>

public class CacheMap
extends TreeMap<String,Object>

Utility class for cache map.

See Also:
Serialized Form

Constructor Summary
CacheMap(int maxSize, int evictSize)
          Constructor of cache map.
 
Method Summary
 Object get(Object key)
           
 Object matchStartsWith(String prefix)
          Search a key that starts with the specified prefix from the map, and return the value corresponding to the key.
 Object put(String key, Object val)
           
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, headMap, keySet, lastKey, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

CacheMap

public CacheMap(int maxSize,
                int evictSize)
Constructor of cache map. If the map exceed the maximum size, the key/value sets will be removed from map based on specified evict size.

Parameters:
maxSize - maximum size of the map
evictSize - number of evict object
Method Detail

put

public Object put(String key,
                  Object val)
Specified by:
put in interface Map<String,Object>
Overrides:
put in class TreeMap<String,Object>

get

public Object get(Object key)
Specified by:
get in interface Map<String,Object>
Overrides:
get in class TreeMap<String,Object>

matchStartsWith

public Object matchStartsWith(String prefix)
Search a key that starts with the specified prefix from the map, and return the value corresponding to the key.

Parameters:
prefix - target prefix
Returns:
the value whose key starts with prefix, or null if not available