@Test public void testAdd() throws Exception { Ticker4Test t = new Ticker4Test(); LocalCacheHandler cache = new LocalCacheHandler(t); int seconds = 100; String key = "key"; String value = "value"; int seconds2 = 200; String key2 = "key2"; String value2 = "value2"; cache.set(key, value, seconds); cache.add(key, value2, seconds); cache.add(key2, value2, seconds2); assertThat((String) cache.get(key), equalTo(value)); assertThat((String) cache.get(key2), equalTo(value2)); }
@Override public void add(String key, Object value, int exptimeSeconds) { long now = ticker.read(); Entry entry = new Entry(value, now + TimeUnit.SECONDS.toNanos(exptimeSeconds)); cache.putIfAbsent(key, entry); }
LocalCacheHandler extends SimpleCacheHandler { @Override public void add(String key, Object value, int exptimeSeconds) { long now = ticker.read(); Entry entry = new Entry(value, now + TimeUnit.SECONDS.toNanos(exptimeSeconds)); cache.putIfAbsent(key, entry); } }
LocalCacheHandler extends SimpleCacheHandler { @Override public void add(String key, Object value, int exptimeSeconds) { long now = ticker.read(); Entry entry = new Entry(value, now + TimeUnit.SECONDS.toNanos(exptimeSeconds)); cache.putIfAbsent(key, entry); } LocalCacheHandler();  LocalCacheHandler(Ticker ticker); }
LocalCacheHandler extends SimpleCacheHandler { @Override public void add(String key, Object value, int exptimeSeconds) { long now = ticker.read(); Entry entry = new Entry(value, now + TimeUnit.SECONDS.toNanos(exptimeSeconds)); cache.putIfAbsent(key, entry); } LocalCacheHandler();  LocalCacheHandler(Ticker ticker); Object get(String key); Map<String, Object> getBulk(Set<String> keys); @Override Object get(String key, Type type); @Override Map<String, Object> getBulk(Set<String> keys, Type type); @Override void set(String key, Object value, int exptimeSeconds); @Override void delete(String key); @Override void add(String key, Object value, int exptimeSeconds); }
LocalCacheHandler extends SimpleCacheHandler { @Override public void add(String key, Object value, int exptimeSeconds) { long now = ticker.read(); Entry entry = new Entry(value, now + TimeUnit.SECONDS.toNanos(exptimeSeconds)); cache.putIfAbsent(key, entry); } LocalCacheHandler();  LocalCacheHandler(Ticker ticker); Object get(String key); Map<String, Object> getBulk(Set<String> keys); @Override Object get(String key, Type type); @Override Map<String, Object> getBulk(Set<String> keys, Type type); @Override void set(String key, Object value, int exptimeSeconds); @Override void delete(String key); @Override void add(String key, Object value, int exptimeSeconds);  }