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) 

Source Link

Document

Get set of Tuple s 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 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 a v a2s.  c om
            return connection.zRangeByScoreWithScores(rawKey, min, max);
        }
    }, true);

    return deserializeTupleValues(rawValues);
}

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

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

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

/**
 * Get set of {@link Tuple}s 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.
 * /*  w  w  w .j a va2s.c  o  m*/
 * @param key key
 * @param range range
 * @param limit limit
 * @return Set<Tuple>
 * @since 1.6
 */
public static Set<Tuple> zRangeByScoreWithScores(byte[] key, Range range, Limit limit) {
    return redisTemplate.execute(new RedisCallback<Set<Tuple>>() {
        @Override
        public Set<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScoreWithScores(key, range, limit);
        }
    });
}

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

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

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

/**
 * Get set of {@link Tuple}s 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.
 * /*from  w w  w  . ja v  a  2s. c om*/
 * @param key key
 * @param range range
 * @param limit limit
 * @return Set<Tuple>
 * @since 1.6
 */
public Set<Tuple> zRangeByScoreWithScores(byte[] key, Range range, Limit limit) {
    return redisTemplate.execute(new RedisCallback<Set<Tuple>>() {
        @Override
        public Set<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScoreWithScores(key, range, limit);
        }
    });
}