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

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

Introduction

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

Prototype

@Nullable
default Set<byte[]> zRevRangeByScore(byte[] key, double min, double max) 

Source Link

Document

Get elements where score is between min and max from sorted set ordered from high to low.

Usage

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

public Set<V> reverseRangeByScore(K key, final double min, final double max) {
    final byte[] rawKey = rawKey(key);

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

        public Set<byte[]> doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//ww w  .j av  a 2 s.c om
            return connection.zRevRangeByScore(rawKey, min, max);
        }
    }, true);

    return deserializeValues(rawValues);
}

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

/**
 * Get elements in range from {@code Limit#offset} to {@code Limit#offset + Limit#count} where score is between
 * {@code Range#min} and {@code Range#max} from sorted set ordered high -> low.
 * // w ww .  j  a v a 2s. co m
 * @param key key
 * @param range range
 * @param limit limit
 * @return Set<byte[]>
 * @since 1.6
 */
public static Set<byte[]> zRevRangeByScore(byte[] key, Range range, Limit limit) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRevRangeByScore(key, range, limit);
        }
    });
}

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

/**
 * Get elements in range from {@code Limit#offset} to {@code Limit#offset + Limit#count} where score is between
 * {@code Range#min} and {@code Range#max} from sorted set ordered high -> low.
 * //  w  ww  .j  a va  2  s  .  c  o  m
 * @param key key
 * @param range range
 * @param limit limit
 * @return Set<byte[]>
 * @since 1.6
 */
public Set<byte[]> zRevRangeByScore(byte[] key, Range range, Limit limit) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRevRangeByScore(key, range, limit);
        }
    });
}