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

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

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

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

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

        @Override//from   ww w  . ja v a  2s.  c  om
        public Cursor<V> doInRedis(RedisConnection connection) throws DataAccessException {
            return new ConvertingCursor<byte[], V>(connection.sScan(rawKey, options),
                    new Converter<byte[], V>() {

                        @Override
                        public V convert(byte[] source) {
                            return deserializeValue(source);
                        }
                    });
        }
    }, true);

}

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

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

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

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