@Test public void testXmemcached() throws Exception { CaMemcached<String, String> ca = new CaMemcached<String, String>(); String key = "key1"; CaValue<String, String> val = ca.read(key); LOG.info("{}", val); key = "key2"; ca.write(val.key(key).value("val2")); LOG.info("{}", ca.read(key)); key = "key3"; ca.write(val.key(key).value("val3").ttl(3000)); LOG.info("{}", ca.read(key)); Thread.sleep(3000L); LOG.info("{}", ca.read(key)); ca.close(); }
@Override public void close() throws IOException { if (isClosed()) return; super.close(); if (mc != null) { try { mc.flushAll(); } catch (TimeoutException | InterruptedException | MemcachedException e) { LOG.warn(e.getMessage(), e); } finally { mc.shutdown(); } } }
CaMemcached extends BasicCa<K, V> { @Override public void close() throws IOException { if (isClosed()) return; super.close(); if (mc != null) { try { mc.flushAll(); } catch (TimeoutException | InterruptedException | MemcachedException e) { LOG.warn(e.getMessage(), e); } finally { mc.shutdown(); } } } }
CaMemcached extends BasicCa<K, V> { @Override public void close() throws IOException { if (isClosed()) return; super.close(); if (mc != null) { try { mc.flushAll(); } catch (TimeoutException | InterruptedException | MemcachedException e) { LOG.warn(e.getMessage(), e); } finally { mc.shutdown(); } } } CaMemcached();  CaMemcached(String name);  CaMemcached(String name, MemcachedClient mc); }
CaMemcached extends BasicCa<K, V> { @Override public void close() throws IOException { if (isClosed()) return; super.close(); if (mc != null) { try { mc.flushAll(); } catch (TimeoutException | InterruptedException | MemcachedException e) { LOG.warn(e.getMessage(), e); } finally { mc.shutdown(); } } } CaMemcached();  CaMemcached(String name);  CaMemcached(String name, MemcachedClient mc); @Override void close(); }
CaMemcached extends BasicCa<K, V> { @Override public void close() throws IOException { if (isClosed()) return; super.close(); if (mc != null) { try { mc.flushAll(); } catch (TimeoutException | InterruptedException | MemcachedException e) { LOG.warn(e.getMessage(), e); } finally { mc.shutdown(); } } } CaMemcached();  CaMemcached(String name);  CaMemcached(String name, MemcachedClient mc); @Override void close();  }