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

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

Introduction

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

Prototype

Cursor<Tuple> zScan(byte[] key, ScanOptions options);

Source Link

Document

Use a Cursor to iterate over elements in sorted set at key .

Usage

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

@Override
public Cursor<TypedTuple<V>> scan(K key, final ScanOptions options) {

    final byte[] rawKey = rawKey(key);
    Cursor<Tuple> cursor = execute(new RedisCallback<Cursor<Tuple>>() {

        @Override//from w  w w .j  a  v a2  s. c  o  m
        public Cursor<Tuple> doInRedis(RedisConnection connection) throws DataAccessException {
            connection.select(dbIndex);
            return connection.zScan(rawKey, options);
        }
    }, true);

    return new ConvertingCursor<Tuple, TypedTuple<V>>(cursor, new Converter<Tuple, TypedTuple<V>>() {

        @Override
        public TypedTuple<V> convert(Tuple source) {
            return deserializeTuple(source);
        }
    });
}

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

/**
 * Use a {@link Cursor} to iterate over elements in sorted set at {@code key}.
 * <p>//from ww  w.j a  v a 2s  . c o  m
 * See http://redis.io/commands/scan
 * 
 * @since 1.4
 * @param key key
 * @param options options
 * @return Cursor<Tuple>
 */
public static Cursor<Tuple> zScan(byte[] key, ScanOptions options) {
    return redisTemplate.execute(new RedisCallback<Cursor<Tuple>>() {
        @Override
        public Cursor<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zScan(key, options);
        }
    });
}

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

/**
 * Use a {@link Cursor} to iterate over elements in sorted set at {@code key}.
 * <p>//from   ww  w.jav  a 2 s .  com
 * See http://redis.io/commands/scan
 * 
 * @since 1.4
 * @param key key
 * @param options options
 * @return Cursor<Tuple>
 */
public Cursor<Tuple> zScan(byte[] key, ScanOptions options) {
    return redisTemplate.execute(new RedisCallback<Cursor<Tuple>>() {
        @Override
        public Cursor<Tuple> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zScan(key, options);
        }
    });
}