@Test void evict_withCacheKey_deletedObjectInCache() throws Exception { MemcachedClientIF client = mock(MemcachedClientIF.class); SimpleSpringMemcached cache = new SimpleSpringMemcached(client, "test"); when(client.delete("test")).thenReturn(new AsyncResult<>(true)); cache.evict("test"); verify(client, times(1)).delete("test"); }
@Override public void evict(Object key) { Assert.notNull(key, "key parameter is mandatory"); Assert.isAssignable(String.class, key.getClass()); try { this.memcachedClientIF.delete((String) key).get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IllegalArgumentException("Error evicting items" + key); } }
SimpleSpringMemcached implements Cache { @Override public void evict(Object key) { Assert.notNull(key, "key parameter is mandatory"); Assert.isAssignable(String.class, key.getClass()); try { this.memcachedClientIF.delete((String) key).get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IllegalArgumentException("Error evicting items" + key); } } }
SimpleSpringMemcached implements Cache { @Override public void evict(Object key) { Assert.notNull(key, "key parameter is mandatory"); Assert.isAssignable(String.class, key.getClass()); try { this.memcachedClientIF.delete((String) key).get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IllegalArgumentException("Error evicting items" + key); } } SimpleSpringMemcached(MemcachedClientIF memcachedClientIF, String cacheName); }
SimpleSpringMemcached implements Cache { @Override public void evict(Object key) { Assert.notNull(key, "key parameter is mandatory"); Assert.isAssignable(String.class, key.getClass()); try { this.memcachedClientIF.delete((String) key).get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IllegalArgumentException("Error evicting items" + key); } } SimpleSpringMemcached(MemcachedClientIF memcachedClientIF, String cacheName); @Override String getName(); @Override Object getNativeCache(); @Override ValueWrapper get(Object key); @Override T get(Object key, Class<T> type); @SuppressWarnings("unchecked") @Override T get(Object key, Callable<T> valueLoader); @Override void put(Object key, Object value); @Override ValueWrapper putIfAbsent(Object key, Object value); @Override void evict(Object key); @Override void clear(); void setExpiration(int expiration); }
SimpleSpringMemcached implements Cache { @Override public void evict(Object key) { Assert.notNull(key, "key parameter is mandatory"); Assert.isAssignable(String.class, key.getClass()); try { this.memcachedClientIF.delete((String) key).get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IllegalArgumentException("Error evicting items" + key); } } SimpleSpringMemcached(MemcachedClientIF memcachedClientIF, String cacheName); @Override String getName(); @Override Object getNativeCache(); @Override ValueWrapper get(Object key); @Override T get(Object key, Class<T> type); @SuppressWarnings("unchecked") @Override T get(Object key, Callable<T> valueLoader); @Override void put(Object key, Object value); @Override ValueWrapper putIfAbsent(Object key, Object value); @Override void evict(Object key); @Override void clear(); void setExpiration(int expiration);  }