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) 

Source Link

Document

Get elements 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 byte[] rawKey = rawKey(key);

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

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

    return deserializeValues(rawValues);
}

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

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

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

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

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

/**
 * Get elements where score is between {@code min} and {@code max} from sorted set.
 * <p>/*from   w w w . j  a va2s.com*/
 * See http://redis.io/commands/zrangebyscore
 * 
 * @since 1.5
 * @param key key
 * @param min min
 * @param max max
 * @return Set<byte[]>
 */
public static Set<byte[]> zRangeByScore(byte[] key, String min, String max) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max);
        }
    });
}

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

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

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

/**
 * Get elements where score is between {@code min} and {@code max} from sorted set.
 * <p>//  w w  w .j av  a2  s  .  c  om
 * See http://redis.io/commands/zrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Set<byte[]>
 */
public Set<byte[]> zRangeByScore(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max);
        }
    });
}

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

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

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

/**
 * Get elements where score is between {@code min} and {@code max} from sorted set.
 * <p>//w  w w  .  j a v  a  2s .com
 * See http://redis.io/commands/zrangebyscore
 * 
 * @since 1.5
 * @param key key
 * @param min min
 * @param max max
 * @return Set<byte[]>
 */
public Set<byte[]> zRangeByScore(byte[] key, String min, String max) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByScore(key, min, max);
        }
    });
}

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

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