Java Code Examples for redis.clients.jedis.ScanParams#SCAN_POINTER_START
The following examples show how to use
redis.clients.jedis.ScanParams#SCAN_POINTER_START .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisIO.java From beam with Apache License 2.0 | 6 votes |
@ProcessElement public void processElement(ProcessContext c) { ScanParams scanParams = new ScanParams(); scanParams.match(c.element()); String cursor = ScanParams.SCAN_POINTER_START; boolean finished = false; while (!finished) { ScanResult<String> scanResult = jedis.scan(cursor, scanParams); List<String> keys = scanResult.getResult(); for (String k : keys) { c.output(k); } cursor = scanResult.getCursor(); if (cursor.equals(ScanParams.SCAN_POINTER_START)) { finished = true; } } }
Example 2
Source File: JedisClientDelegate.java From kork with Apache License 2.0 | 6 votes |
@Override public void withKeyScan(String pattern, int count, Consumer<RedisScanResult> f) { ScanParams params = new ScanParams().match(pattern).count(count); String cursor = ScanParams.SCAN_POINTER_START; try (Jedis jedis = jedisPool.getResource()) { do { ScanResult<String> result = jedis.scan(cursor, params); final List<String> results = result.getResult(); f.accept(() -> results); cursor = result.getCursor(); } while (!"0".equals(cursor)); } }
Example 3
Source File: RedisPermissionsRepository.java From fiat with Apache License 2.0 | 5 votes |
private Set<String> scanSet(String key) { final Set<String> results = new HashSet<>(); final AtomicReference<String> cursor = new AtomicReference<>(ScanParams.SCAN_POINTER_START); do { final ScanResult<String> result = redisClientDelegate.withCommandsClient( jedis -> { return jedis.sscan(key, cursor.get()); }); results.addAll(result.getResult()); cursor.set(result.getCursor()); } while (!"0".equals(cursor.get())); return results; }