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

RPOP and LPOP do not support count argument #2668

Closed
ajmichels opened this issue Dec 15, 2023 · 2 comments
Closed

RPOP and LPOP do not support count argument #2668

ajmichels opened this issue Dec 15, 2023 · 2 comments

Comments

@ajmichels
Copy link

ajmichels commented Dec 15, 2023

Motivation

In Redis v6.2 a second argument was added to the RPOP and LPOP commands that allows for specifying a count of items that should be attempted to fetch from a list. It doesn't look like this support has been added to the library yet. Without these extra arguments is the necessary to perform a multi-command request. I realize it is possible to use client.sendCommand(['RPOP', 'key', '10']), I am just not sure what this project's stance is on feature parity.

Adding support for this would require that RPOP and LPOP return different data types (string or array) depending on the arguments given.

Basic Code Example

await client.RPOP('myKey');
// 'value'

await client.RPOP('myKey', 1);
// ['value']

await client.RPOP('myKey', 2);
// ['value1', 'value2']
@leibale
Copy link
Contributor

leibale commented Dec 25, 2023

since the count argument changes the reply type it is exposed as RPOP_COUNT/rPopCount

@leibale leibale closed this as completed Dec 25, 2023
@ajmichels
Copy link
Author

Thanks. That is helpful.

Out of curiosity, how was one supposed to know that was available in the API? I have run into numerous situations where situations where "out of the box commands" don't really work but there isn't really anything in the docs for this package explaining that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants