|
30 | 30 | import org.springframework.data.redis.connection.RedisHashCommands;
|
31 | 31 | import org.springframework.data.redis.connection.convert.Converters;
|
32 | 32 | import org.springframework.data.redis.core.Cursor;
|
| 33 | +import org.springframework.data.redis.core.Cursor.CursorId; |
33 | 34 | import org.springframework.data.redis.core.KeyBoundCursor;
|
34 | 35 | import org.springframework.data.redis.core.ScanIteration;
|
35 | 36 | import org.springframework.data.redis.core.ScanOptions;
|
@@ -149,8 +150,7 @@ public List<Entry<byte[], byte[]>> hRandFieldWithValues(byte[] key, long count)
|
149 | 150 |
|
150 | 151 | List<Entry<byte[], byte[]>> convertedMapEntryList = new ArrayList<>(mapEntryList.size());
|
151 | 152 |
|
152 |
| - mapEntryList.forEach(entry -> |
153 |
| - convertedMapEntryList.add(Converters.entryOf(entry.getKey(), entry.getValue()))); |
| 153 | + mapEntryList.forEach(entry -> convertedMapEntryList.add(Converters.entryOf(entry.getKey(), entry.getValue()))); |
154 | 154 |
|
155 | 155 | return convertedMapEntryList;
|
156 | 156 |
|
@@ -219,34 +219,27 @@ public List<byte[]> hVals(byte[] key) {
|
219 | 219 |
|
220 | 220 | @Override
|
221 | 221 | public Cursor<Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) {
|
222 |
| - return hScan(key, 0, options); |
| 222 | + return hScan(key, CursorId.initial(), options); |
223 | 223 | }
|
224 | 224 |
|
225 |
| - /** |
226 |
| - * @since 1.4 |
227 |
| - * @param key |
228 |
| - * @param cursorId |
229 |
| - * @param options |
230 |
| - * @return |
231 |
| - */ |
232 |
| - public Cursor<Entry<byte[], byte[]>> hScan(byte[] key, long cursorId, ScanOptions options) { |
| 225 | + public Cursor<Entry<byte[], byte[]>> hScan(byte[] key, CursorId cursorId, ScanOptions options) { |
233 | 226 |
|
234 | 227 | Assert.notNull(key, "Key must not be null");
|
235 | 228 |
|
236 | 229 | return new KeyBoundCursor<Entry<byte[], byte[]>>(key, cursorId, options) {
|
237 | 230 |
|
238 | 231 | @Override
|
239 |
| - protected ScanIteration<Entry<byte[], byte[]>> doScan(byte[] key, long cursorId, ScanOptions options) { |
| 232 | + protected ScanIteration<Entry<byte[], byte[]>> doScan(byte[] key, CursorId cursorId, ScanOptions options) { |
240 | 233 |
|
241 | 234 | if (isQueueing() || isPipelined()) {
|
242 | 235 | throw new InvalidDataAccessApiUsageException("'HSCAN' cannot be called in pipeline / transaction mode");
|
243 | 236 | }
|
244 | 237 |
|
245 | 238 | ScanParams params = JedisConverters.toScanParams(options);
|
246 | 239 |
|
247 |
| - ScanResult<Entry<byte[], byte[]>> result = connection.getJedis().hscan(key, JedisConverters.toBytes(cursorId), |
248 |
| - params); |
249 |
| - return new ScanIteration<>(Long.valueOf(result.getCursor()), result.getResult()); |
| 240 | + ScanResult<Entry<byte[], byte[]>> result = connection.getJedis().hscan(key, |
| 241 | + JedisConverters.toBytes(cursorId), params); |
| 242 | + return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult()); |
250 | 243 | }
|
251 | 244 |
|
252 | 245 | @Override
|
|
0 commit comments