Example usage for org.springframework.data.redis.connection RedisConnection decrBy

List of usage examples for org.springframework.data.redis.connection RedisConnection decrBy

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection decrBy.

Prototype

@Nullable
Long decrBy(byte[] key, long value);

Source Link

Document

Decrement an integer value stored as string value of key by value .

Usage

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Increment value of {@code key} by {@code value}.
 * <p>/*from   w ww  .  j a v  a 2s  .c om*/
 * See http://redis.io/commands/decrby
 * 
 * @param key must not be {@literal null}.
 * @param value value
 * @return Long
 */
public static Long decrBy(byte[] key, long value) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.decrBy(key, value);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Increment value of {@code key} by {@code value}.
 * <p>//from www. ja  va2s  .c o m
 * See http://redis.io/commands/decrby
 * 
 * @param key must not be {@literal null}.
 * @param value value
 * @return Long
 */
public Long decrBy(byte[] key, long value) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.decrBy(key, value);
        }
    });
}