public void clear() { client.flush(); }
@Override public void delete(Set<CacheKeyTO> keys) throws CacheCenterConnectionException { if (null == memcachedClient || null == keys || keys.isEmpty()) { return; } String hfield; for (CacheKeyTO cacheKeyTO : keys) { if (null == cacheKeyTO) { continue; } String cacheKey = cacheKeyTO.getCacheKey(); if (null == cacheKey || cacheKey.isEmpty()) { continue; } hfield = cacheKeyTO.getHfield(); if (null != hfield && hfield.length() > 0) { throw new RuntimeException("memcached does not support hash cache."); } try { String allKeysPattern = "*"; if (allKeysPattern.equals(cacheKey)) { memcachedClient.flush(); } else { memcachedClient.delete(cacheKey); } } catch (Exception e) { log.error(e.getMessage(), e); } } }
@Override public void clear() { client.flush(); }
/** * Flush all caches from all servers immediately. * * @return whether or not the operation was performed * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public OperationFuture<Boolean> flush() { return flush(-1); }
/** * Flush all caches from all servers immediately. * * @return whether or not the operation was performed * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public Future<Boolean> flush() { return flush(-1); }
@Override public void clear() { client.flush(); }
/** * Flush all caches from all servers immediately. * * @return whether or not the operation was performed * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ public OperationFuture<Boolean> flush() { return flush(-1); }
/** * Flush all caches from all servers immediately. * * @return whether or not the operation was performed * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public OperationFuture<Boolean> flush() { return flush(-1); }
/** * Flush all caches from all servers immediately. * @return whether or not the operation was performed * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public Future<Boolean> flush() { return flush(-1); }
/** * Flush all caches from all servers immediately. * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public Future<Boolean> flush() { return flush(-1); }
public void evictAll() { client.flush(); }
@Override public void clear() { client.flush(); } }
@Override public void wipe() throws IOException { client.flush(); }
public void evictAll() { client.flush(); }
@Override public void invalidateAll() { client.flush(); }
public void close() { if (clearAtClose) { client.flush(); client.shutdown(); } }
@Override public void cleanup() { client.flush(); client.shutdown(); client = null; } }
public void testFlush() throws Exception { MemcachedClient client = bootstrapClient(); Future<Boolean> b = client.flush(); assertTrue(b.get()); assertNull(client.get("key")); assertNull(client.get("key1")); }
public void testFlushDelay() throws Exception { MemcachedClient client = bootstrapClient(); Future<Boolean> b = client.flush(5); assertTrue(b.get()); assertNotNull(client.get("key")); assertNotNull(client.get("key1")); Thread.sleep(8*1000); assertNull(client.get("key")); assertNull(client.get("key1")); }
@JRubyMethod public IRubyObject flush(ThreadContext context) { Ruby ruby = context.getRuntime(); try { client.flush().get(); return context.nil; } catch (OperationTimeoutException e) { throw Error.newATimeoutOccurred(ruby, e.getLocalizedMessage()); } catch (ExecutionException e) { throw ruby.newRuntimeError(e.getLocalizedMessage()); } catch (InterruptedException e) { throw ruby.newThreadError(e.getLocalizedMessage()); } }