import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap; public class SimpleCache { private final ConcurrentLinkedHashMap<String, Object> cache; public SimpleCache(int capacity) { cache = new ConcurrentLinkedHashMap.Builder<String, Object>() .maximumWeightedCapacity(capacity) .build(); } public Object get(String key) { return cache.get(key); } public void put(String key, Object value) { cache.put(key, value); } public void remove(String key) { cache.remove(key); } }


上一篇:
下一篇:
切换中文