I run a lot of rate limiters and quota counters the same way: INCR the key, and if it comes back 1 , set an expiry on it so the window resets later. It works, but it is two round trips to the database for something that is conceptually one operation, and there has always been a gap between those...

Source: [Dev.to](https://dev.to/alexgeorgiev17/valkey-92s-increx-command-removes-the-crash-window-between-incr-and-expire-1344)

Sponsored