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, double min, double max, long offset, long count) 

Source Link

Document

Get elements 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<V> rangeByScore(K key, final double min, final double max, final long offset, final long count) {
    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 o m*/
            return connection.zRangeByScore(rawKey, min, max, offset, count);
        }
    }, true);

    return deserializeValues(rawValues);
}

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

/**
 * Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
 * sorted set./*from  w ww. j a  v a2  s .  c  o 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<byte[]>
 */
public static Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max, offset, count);
        }
    });
}

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

/**
 * Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
 * sorted set.//from   w  w  w.ja v a  2  s  .  c o m
 * <p>
 * See http://redis.io/commands/zrangebyscore
 * 
 * @since 1.5
 * @param key key
 * @param min min
 * @param max max
 * @param offset offset
 * @param count count
 * @return Set<byte[]>
 */
public static Set<byte[]> zRangeByScore(byte[] key, String min, String max, long offset, long count) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max, offset, count);
        }
    });
}

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

/**
 * Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
 * sorted set./*w w w.ja  v a  2 s  . 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<byte[]>
 */
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max, offset, count);
        }
    });
}

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

/**
 * Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
 * sorted set./* w  w w. ja va  2s .co m*/
 * <p>
 * See http://redis.io/commands/zrangebyscore
 * 
 * @since 1.5
 * @param key key
 * @param min min
 * @param max max
 * @param offset offset
 * @param count count
 * @return Set<byte[]>
 */
public Set<byte[]> zRangeByScore(byte[] key, String min, String max, long offset, long count) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max, offset, count);
        }
    });
}