Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Add nx, xx, gt and lt to .expire #1385

Open
1 task done
sobolevn opened this issue Jun 30, 2022 · 1 comment
Open
1 task done

Add nx, xx, gt and lt to .expire #1385

sobolevn opened this issue Jun 30, 2022 · 1 comment

Comments

@sobolevn
Copy link

Is your feature request related to a problem?

Right now redis.asyncio.Redis and aioredis have different signatures for .expire.
When wirtting code that support both versions, one has to do something like this: https://github.com/wemake-services/asyncio-redis-rate-limit/blob/6079ee499e6e8f57719519806b1d6514e121ab5a/asyncio_redis_rate_limit/compat.py#L43-L58

Describe the solution you'd like

I propose to add nx, xx, gt, lt boolean options to def expire, like it is in redis.py: https://github.com/redis/redis-py/blob/d3a7a75c7b106e0864b3927c0904058e25c99958/redis/commands/core.py#L1620-L1623

This will make signatures compatible.
This will also make .set and .expire very similar.

Describe alternatives you've considered

Using .set(..., nx=True). It is not the same thing.
Especially with pipelines.

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@sobolevn
Copy link
Author

If maintainers are fine with this feature, I can send a PR :)

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

No branches or pull requests

1 participant