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

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

Introduction

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

Prototype

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

Source Link

Document

Get elements in range from start to end from sorted set ordered from high to low.

Usage

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

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

    Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {

        public Set<byte[]> doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*from w w  w  . j a  v a 2s.com*/
            return connection.zRevRange(rawKey, start, end);
        }
    }, true);

    return deserializeValues(rawValues);
}

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

/**
 * Get elements in range from {@code begin} to {@code end} from sorted set ordered from high to low.
 * <p>/*from ww  w  .ja  va  2s .  co m*/
 * See http://redis.io/commands/zrevrange
 * 
 * @param key key
 * @param begin begin
 * @param end end
 * @return Set<byte[]>
 */
public static Set<byte[]> zRevRange(byte[] key, long begin, long end) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRevRange(key, begin, end);
        }
    });
}

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

/**
 * Get elements in range from {@code begin} to {@code end} from sorted set ordered from high to low.
 * <p>/*from   w w  w .j  a v a  2  s. c  o  m*/
 * See http://redis.io/commands/zrevrange
 * 
 * @param key key
 * @param begin begin
 * @param end end
 * @return Set<byte[]>
 */
public Set<byte[]> zRevRange(byte[] key, long begin, long end) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRevRange(key, begin, end);
        }
    });
}