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

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

Introduction

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

Prototype

@Nullable
default Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) 

Source Link

Document

Get set of Tuple s in range from start to end where score is between min and max from sorted set.

Usage

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

public Set<TypedTuple<V>> rangeByScoreWithScores(K key, final double min, final double max, final long offset,
        final long count) {
    final byte[] rawKey = rawKey(key);

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

        public Set<Tuple> doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*w  w  w .j  av  a 2 s. com*/
            return connection.zRangeByScoreWithScores(rawKey, min, max, offset, count);
        }
    }, true);

    return deserializeTupleValues(rawValues);
}

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

/**
 * Get set of {@link Tuple}s in range from {@code begin} to {@code end} where score is between {@code min} and
 * {@code max} from sorted set.//w ww  . j  av a  2s  .  co  m
 * <p>
 * See http://redis.io/commands/zrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @param offset offset
 * @param count count
 * @return Set<Tuple>
 */
public static Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) {
    return redisTemplate.execute(new RedisCallback<Set<Tuple>>() {
        @Override
        public Set<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScoreWithScores(key, min, max, offset, count);
        }
    });
}

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

/**
 * Get set of {@link Tuple}s in range from {@code begin} to {@code end} where score is between {@code min} and
 * {@code max} from sorted set./* w ww.j  a  va 2s . c om*/
 * <p>
 * See http://redis.io/commands/zrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @param offset offset
 * @param count count
 * @return Set<Tuple>
 */
public Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) {
    return redisTemplate.execute(new RedisCallback<Set<Tuple>>() {
        @Override
        public Set<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScoreWithScores(key, min, max, offset, count);
        }
    });
}