Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add novalues option to HSCAN. #2612

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions commands/scan.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,39 @@ 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 NOSCORES/NOVALUES option

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope you don't mind a little bit of copy-editing.

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


Similarly, when using `ZSCAN`, you can use `NOSCORES` option to make Redis return only the members in the zset, without their corresponding scores.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Similarly, when using `ZSCAN`, you can use `NOSCORES` option to make Redis return only the members in the zset, without their corresponding scores.
Similarly, when using `ZSCAN`, you can use the `NOSCORES` option to make Redis return only the members in the sorted set without their corresponding scores.


```
redis 127.0.0.1:6379> HMSET myhash a 1 b 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since HMSET is deprecated, let's use HSET.

Suggested change
redis 127.0.0.1:6379> HMSET myhash a 1 b 2
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"
redis 127.0.0.1:6379> ZADD myzset 1 a 2 b
(integer) 2
redis 127.0.0.1:6379> ZSCAN myzset 0
1) "0"
2) 1) "a"
2) "1"
3) "b"
4) "2"
redis 127.0.0.1:6379> ZSCAN myzset 0 NOSCORES
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
Loading