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

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

Introduction

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

Prototype

@Nullable
Set<Tuple> zRangeWithScores(byte[] key, long start, long end);

Source Link

Document

Get set of Tuple s between start and end from sorted set.

Usage

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

public Set<TypedTuple<V>> rangeWithScores(K key, final long start, final long end) {
    final byte[] rawKey = rawKey(key);

    Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {

        public Set<Tuple> doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from w w w . j av  a2 s  .c om
            return connection.zRangeWithScores(rawKey, start, end);
        }
    }, true);

    return deserializeTupleValues(rawValues);
}

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

/**
 * Get set of {@link Tuple}s between {@code begin} and {@code end} from sorted set.
 * <p>/*from   www. j a va 2 s .c  o  m*/
 * See http://redis.io/commands/zrange
 * 
 * @param key key
 * @param begin begin
 * @param end end
 * @return Set<Tuple>
 */
public static Set<Tuple> zRangeWithScores(byte[] key, long begin, long end) {
    return redisTemplate.execute(new RedisCallback<Set<Tuple>>() {
        @Override
        public Set<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeWithScores(key, begin, end);
        }
    });
}

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

/**
 * Get set of {@link Tuple}s between {@code begin} and {@code end} from sorted set.
 * <p>//from  www.ja  v  a 2 s  . com
 * See http://redis.io/commands/zrange
 * 
 * @param key key
 * @param begin begin
 * @param end end
 * @return Set<Tuple>
 */
public Set<Tuple> zRangeWithScores(byte[] key, long begin, long end) {
    return redisTemplate.execute(new RedisCallback<Set<Tuple>>() {
        @Override
        public Set<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeWithScores(key, begin, end);
        }
    });
}