public void put(String key, JsonPath value) { JsonPath oldValue = map.put(key, value); if (oldValue != null) { removeThenAddKey(key); } else { addKey(key); } if (map.size() > limit) { map.remove(removeLast()); } }
public void remove(String key) { removeFirstOccurrence(key); map.remove(key); }
@Test public void issue_94_2() throws Exception { LRUCache cache = new LRUCache(5); cache.put("1", dummy); cache.put("2", dummy); cache.put("3", dummy); cache.put("4", dummy); cache.put("5", dummy); cache.put("6", dummy); cache.get("1"); cache.get("2"); cache.get("3"); cache.get("4"); cache.get("5"); cache.get("6"); cache.get("2"); cache.get("3"); cache.get("4"); cache.get("5"); cache.get("6"); cache.get("3"); cache.get("4"); cache.get("5"); cache.get("6"); cache.get("4");
private static Cache getDefaultCache(){ return new LRUCache(400); //return new NOOPCache(); } }
public JsonPath get(String key) { JsonPath jsonPath = map.get(key); if(jsonPath != null){ removeThenAddKey(key); } return jsonPath; }
private static Cache getDefaultCache(){ return new LRUCache(400); //return new NOOPCache(); } }
public JsonPath get(String key) { JsonPath jsonPath = map.get(key); if(jsonPath != null){ removeThenAddKey(key); } return jsonPath; }
public void put(String key, JsonPath value) { JsonPath oldValue = map.put(key, value); if (oldValue != null) { removeThenAddKey(key); } else { addKey(key); } if (map.size() > limit) { map.remove(removeLast()); } }
CacheProvider.setCache(new LRUCache(100));
public JsonPath get(String key) { JsonPath jsonPath = map.get(key); if(jsonPath != null){ removeThenAddKey(key); } return jsonPath; }
public void remove(String key) { removeFirstOccurrence(key); map.remove(key); }
public void put(String key, JsonPath value) { JsonPath oldValue = map.put(key, value); if (oldValue != null) { removeThenAddKey(key); } else { addKey(key); } if (map.size() > limit) { map.remove(removeLast()); } }
private static Cache getDefaultCache(){ return new LRUCache(400); //return new NOOPCache(); } }
public void remove(String key) { removeFirstOccurrence(key); map.remove(key); }