1 18 package org.apache.activemq.memory; 19 20 import java.util.Map ; 21 22 import java.util.concurrent.ConcurrentHashMap ; 23 24 30 public class MapCache implements Cache { 31 32 protected final Map map; 33 34 public MapCache() { 35 this(new ConcurrentHashMap ()); 36 } 37 38 public MapCache(Map map) { 39 this.map = map; 40 } 41 42 public Object put(Object key, Object value) { 43 return map.put(key, value); 44 } 45 46 public Object get(Object key) { 47 return map.get(key); 48 } 49 50 public Object remove(Object key) { 51 return map.remove(key); 52 } 53 54 public void close() { 55 map.clear(); 56 } 57 58 public int size() { 59 return map.size(); 60 } 61 } 62 | Popular Tags |