/** * Decrease value by one * * @return * @throws MemcachedException * @throws InterruptedException * @throws TimeoutException */ public long decrementAndGet() throws MemcachedException, InterruptedException, TimeoutException { return this.memcachedClient.decr(this.key, 1, this.initialValue); }
/** * Add value and get the result * * @param delta * @return * @throws MemcachedException * @throws InterruptedException * @throws TimeoutException */ public long addAndGet(long delta) throws MemcachedException, InterruptedException, TimeoutException { if (delta >= 0) { return this.memcachedClient.incr(this.key, delta, this.initialValue); } else { return this.memcachedClient.decr(this.key, -delta, this.initialValue); } }
/** * Decrease value by one * * @return * @throws MemcachedException * @throws InterruptedException * @throws TimeoutException */ public long decrementAndGet() throws MemcachedException, InterruptedException, TimeoutException { return this.memcachedClient.decr(this.key, 1, this.initialValue); }
@Override public long decr(final String key, final int by, final long def) throws TimeoutException, CacheException { try { return memcachedClient.decr(key, by, def); } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
@Override public long decr(final String key, final int by) throws TimeoutException, CacheException { try { return memcachedClient.decr(key, by); } catch (MemcachedException | InterruptedException e) { throw new CacheException(e); } }
/** * Add value and get the result * * @param delta * @return * @throws MemcachedException * @throws InterruptedException * @throws TimeoutException */ public long addAndGet(long delta) throws MemcachedException, InterruptedException, TimeoutException { if (delta >= 0) { return this.memcachedClient.incr(this.key, delta, this.initialValue); } else { return this.memcachedClient.decr(this.key, -delta, this.initialValue); } }