Reputation: 1813
INCR mykey
initiates to 0 and increments the value to 1. How would I set expiration time to the mykey
in the same command like it can be done with SETEX
?
Upvotes: 2
Views: 3017
Reputation: 7267
you can use pipeline or a lua script
in fact, in redis documentation, there is an example of implementing rate limit that needs to increase and set ttl using multi
https://redis.io/commands/INCR
Upvotes: 6