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

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

Introduction

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

Prototype

@Nullable
Long zAdd(byte[] key, Set<Tuple> tuples);

Source Link

Document

Add tuples to a sorted set at key , or update its score if it already exists.

Usage

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

public Long add(K key, Set<TypedTuple<V>> tuples) {
    final byte[] rawKey = rawKey(key);
    final Set<Tuple> rawValues = rawTupleValues(tuples);

    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from  w w w  .  jav  a2  s.  co m
            return connection.zAdd(rawKey, rawValues);
        }
    }, true);
}

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

/**
 * Add {@code tuples} to a sorted set at {@code key}, or update its {@code score} if it already exists.
 * <p>/*w  w w . j ava  2  s . co m*/
 * See http://redis.io/commands/zadd
 * 
 * @param key key
 * @param tuples tuples
 * @return Long
 */
public static Long zAdd(byte[] key, Set<Tuple> tuples) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zAdd(key, tuples);
        }
    });
}

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

/**
 * Add {@code tuples} to a sorted set at {@code key}, or update its {@code score} if it already exists.
 * <p>/*from w w w. j  a  va2  s.  c om*/
 * See http://redis.io/commands/zadd
 * 
 * @param key key
 * @param tuples tuples
 * @return Long
 */
public Long zAdd(byte[] key, Set<Tuple> tuples) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zAdd(key, tuples);
        }
    });
}