org.apache.activemq.memory
Class MapCache

java.lang.Object
  extended by org.apache.activemq.memory.MapCache
All Implemented Interfaces:
Cache

public class MapCache
extends Object
implements Cache

Use any Map to implement the Cache. No cache eviction going on here. Just gives a Map a Cache interface.


Field Summary
protected  Map<Object,Object> map
           
 
Constructor Summary
MapCache()
           
MapCache(Map<Object,Object> map)
           
 
Method Summary
 void close()
          Lets a cache know it will not be used any further and that it can release acquired resources
 Object get(Object key)
          Gets an object that was previously put into this object.
 Object put(Object key, Object value)
          Puts an object into the cache.
 Object remove(Object key)
          Removes an object from the cache.
 int size()
          How big is the cache right now?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected final Map<Object,Object> map
Constructor Detail

MapCache

public MapCache()

MapCache

public MapCache(Map<Object,Object> map)
Method Detail

put

public Object put(Object key,
                  Object value)
Description copied from interface: Cache
Puts an object into the cache.

Specified by:
put in interface Cache

get

public Object get(Object key)
Description copied from interface: Cache
Gets an object that was previously put into this object.

Specified by:
get in interface Cache
Returns:
null if the object was not previously put or if the object has expired out of the cache.

remove

public Object remove(Object key)
Description copied from interface: Cache
Removes an object from the cache.

Specified by:
remove in interface Cache
Returns:
the object associated with the key if it was still in the cache.

close

public void close()
Description copied from interface: Cache
Lets a cache know it will not be used any further and that it can release acquired resources

Specified by:
close in interface Cache

size

public int size()
Description copied from interface: Cache
How big is the cache right now?

Specified by:
size in interface Cache
Returns:


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.