List of usage examples for org.springframework.data.redis.connection RedisConnection hScan
Cursor<Map.Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options);
From source file:com.mauersu.util.redis.DefaultHashOperations.java
@Override public Cursor<Entry<HK, HV>> scan(K key, final ScanOptions options) { final byte[] rawKey = rawKey(key); return execute(new RedisCallback<Cursor<Map.Entry<HK, HV>>>() { @Override/*from ww w . j a v a2 s. c om*/ public Cursor<Entry<HK, HV>> doInRedis(RedisConnection connection) throws DataAccessException { return new ConvertingCursor<Map.Entry<byte[], byte[]>, Map.Entry<HK, HV>>( connection.hScan(rawKey, options), new Converter<Map.Entry<byte[], byte[]>, Map.Entry<HK, HV>>() { @Override public Entry<HK, HV> convert(final Entry<byte[], byte[]> source) { return new Map.Entry<HK, HV>() { @Override public HK getKey() { return deserializeHashKey(source.getKey()); } @Override public HV getValue() { return deserializeHashValue(source.getValue()); } @Override public HV setValue(HV value) { throw new UnsupportedOperationException( "Values cannot be set when scanning through entries."); } }; } }); } }, true); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Use a {@link Cursor} to iterate over entries in hash at {@code key}. * //from www. j a v a 2s. c o m * @since 1.4 * @see http://redis.io/commands/scan * @param key key * @param options options * @return Cursor */ public static Cursor<Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) { return redisTemplate.execute(new RedisCallback<Cursor<Entry<byte[], byte[]>>>() { @Override public Cursor<Entry<byte[], byte[]>> doInRedis(RedisConnection redis) throws DataAccessException { return redis.hScan(key, options); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Use a {@link Cursor} to iterate over entries in hash at {@code key}. * //from ww w.j a v a 2s. c o m * @since 1.4 * @see http://redis.io/commands/scan * @param key key * @param options options * @return Cursor */ public Cursor<Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) { return redisTemplate.execute(new RedisCallback<Cursor<Entry<byte[], byte[]>>>() { @Override public Cursor<Entry<byte[], byte[]>> doInRedis(RedisConnection redis) throws DataAccessException { return redis.hScan(key, options); } }); }