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

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

Introduction

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

Prototype

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

Source Link

Document

Increment an integer value stored of key by delta .

Usage

From source file:com.mauersu.util.redis.DefaultValueOperations.java

public Double increment(K key, final double delta) {
    final byte[] rawKey = rawKey(key);
    return execute(new RedisCallback<Double>() {
        public Double doInRedis(RedisConnection connection) {
            connection.select(dbIndex);// w ww .ja va2 s.c  o  m
            return connection.incrBy(rawKey, delta);
        }
    }, true);
}

From source file:com.mauersu.util.redis.DefaultValueOperations.java

public Long increment(K key, final long delta) {
    final byte[] rawKey = rawKey(key);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//w w  w  .  j a v  a2s  .  co  m
            return connection.incrBy(rawKey, delta);
        }
    }, true);
}

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

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

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

/**
 * Increment value of {@code key} by {@code value}.
 * <p>//from w w w . ja  v  a2  s  .c  o m
 * See http://redis.io/commands/incrbyfloat
 * 
 * @param key must not be {@literal null}.
 * @param value value
 * @return Double
 */
public static Double incrBy(byte[] key, double value) {
    return redisTemplate.execute(new RedisCallback<Double>() {
        @Override
        public Double doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.incrBy(key, value);
        }
    });
}

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

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

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

/**
 * Increment value of {@code key} by {@code value}.
 * <p>//w  w  w  .  j  ava 2  s.co m
 * See http://redis.io/commands/incrbyfloat
 * 
 * @param key must not be {@literal null}.
 * @param value value
 * @return Double
 */
public Double incrBy(byte[] key, double value) {
    return redisTemplate.execute(new RedisCallback<Double>() {
        @Override
        public Double doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.incrBy(key, value);
        }
    });
}