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

Expire with nx option not worked on keydb #213

Open
GrozniyToaster opened this issue Aug 29, 2024 · 3 comments
Open

Expire with nx option not worked on keydb #213

GrozniyToaster opened this issue Aug 29, 2024 · 3 comments

Comments

@GrozniyToaster
Copy link

We tried to set ratelimits on keydb, but it didn’t work(

Crash with the error redis.exceptions.ResponseError: Command # 2 (EXPIRE jms:ratelimit:8badef9b1bae26f59 86400 NX) of pipeline caused error: ("wrong number of arguments for 'expire' command",)

It seems there are a lot of problems due to the option)

https://docs.keydb.dev/docs/commands/#expire
https://redis.io/docs/latest/commands/expire/

@sobolevn
Copy link
Member

Does

    return pipeline.execute_command(  # type: ignore
        'EXPIRE',
        cache_key,
        seconds,
        'NX',
    )

work for you?

@GrozniyToaster
Copy link
Author

Unfortunately not

I have attached the error above with an example command

EXPIRE jms:ratelimit:8badef9b1bae26f59 86400 NX) of pipeline caused error: ("wrong number of arguments for 'expire' command",)

And in the command doc there is no mention of additional options like NX

We've subclassed it for now

But it seems we can add something like a use_nx flag to the class settings

And depending on it add NX

I can design an MR with this idea

@sobolevn
Copy link
Member

@GrozniyToaster please do! 🙏

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