/** * @throws Exception If failed. */ @Test public void testDecrement() throws Exception { Assert.assertEquals(5, client.decr("decrKey", 10, 15)); assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get()); Assert.assertEquals(2, client.decr("decrKey", 3, 0)); assertEquals(2, grid(0).atomicLong("decrKey", 0, true).get()); }
@Override public long decr(final String key, final int by) throws TimeoutException, CacheException { try { return memcachedClient.decr(key, by); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while decr {}", key, e); throw new TimeoutException(e.getMessage()); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }
@Override public long decr(final String key, final int by) throws TimeoutException, CacheException { try { return memcachedClient.decr(key, by); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while decr {}", key, e); throw new TimeoutException(e.getMessage()); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }
@Override public long decr(final String key, final int by, final long def) throws TimeoutException, CacheException { try { return memcachedClient.decr(key, by, def); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while decr {}", key, e); throw new TimeoutException(e.getMessage()); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }
@Override public long decr(final String key, final int by, final long def) throws TimeoutException, CacheException { try { return memcachedClient.decr(key, by, def); } catch (OperationTimeoutException e) { LOGGER.warn("Operation timeout while decr {}", key, e); throw new TimeoutException(e.getMessage()); } catch (RuntimeException e) { if (translateException(e)) { throw new CacheException(e); } throw e; } }