Skip to content

Commit

Permalink
Add novalues option to HSCAN. (#2612)
Browse files Browse the repository at this point in the history
Doc of redis/redis#12765.

---------

Co-authored-by: Oran Agra <oran@redislabs.com>
  • Loading branch information
CharlesChen888 and oranagra authored Mar 1, 2024
1 parent aebf9fb commit 438e8b1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions commands/scan.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,25 @@ redis 127.0.0.1:6379> SCAN 0 TYPE zset

It is important to note that the **TYPE** filter is also applied after elements are retrieved from the database, so the option does not reduce the amount of work the server has to do to complete a full iteration, and for rare types you may receive no elements in many iterations.

## The NOVALUES option

When using `HSCAN`, you can use the `NOVALUES` option to make Redis return only the keys in the hash table without their corresponding values.

```
redis 127.0.0.1:6379> HSET myhash a 1 b 2
OK
redis 127.0.0.1:6379> HSCAN myhash 0
1) "0"
2) 1) "a"
2) "1"
3) "b"
4) "2"
redis 127.0.0.1:6379> HSCAN myhash 0 NOVALUES
1) "0"
2) 1) "a"
2) "b"
```

## Multiple parallel iterations

It is possible for an infinite number of clients to iterate the same collection at the same time, as the full state of the iterator is in the cursor, that is obtained and returned to the client at every call. No server side state is taken at all.
Expand Down

0 comments on commit 438e8b1

Please sign in to comment.