GoogleConcurrentLruCache { public void put(K key, V value) { cache.put(key, value); } GoogleConcurrentLruCache();  GoogleConcurrentLruCache(int capacity);  GoogleConcurrentLruCache(int capacity, EvictionListener<K, V> listener); long capacity(); boolean isEmpty(); int size(); void clear(); V get(Object key); void put(K key, V value); boolean putIfAbsent(K key, V value); boolean replace(K key, V old, V value); void remove(K key); Set<K> keySet(); Set<K> hotKeySet(int n); boolean containsKey(K key); String getStatus(); static final int DEFAULT_CONCURENCY_LEVEL; }
@Test public void testSimple() { GoogleConcurrentLruCache cache = new GoogleConcurrentLruCache(10, new EvictionListener<String, String>() { public void onEviction(String key, String value) { System.out.println("evict key:" + key + " values:" + value); } }); for (int i = 0; i < 11; i++) { cache.put("key" + i, "value" + i); } }