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