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

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

Introduction

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

Prototype

@Nullable
default Set<byte[]> zRangeByScore(byte[] key, Range range) 

Source Link

Document

Get elements where score is between Range#min and Range#max from sorted set.

Usage

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

/**
 * Get elements where score is between {@code Range#min} and {@code Range#max} from sorted set.
 * // www  . j a va 2  s  . c o  m
 * @param key key
 * @param range range
 * @return Set<byte[]>
 * @since 1.6
 */
public static Set<byte[]> zRangeByScore(byte[] key, Range range) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, range);
        }
    });
}

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

/**
 * Get elements where score is between {@code Range#min} and {@code Range#max} from sorted set.
 * //from   www. j av  a 2  s.  c  o m
 * @param key key
 * @param range range
 * @return Set<byte[]>
 * @since 1.6
 */
public Set<byte[]> zRangeByScore(byte[] key, Range range) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, range);
        }
    });
}