Valkey 9.2 adds INCREX command combining increment and expiry
Valkey 9.2.0-rc1 introduces INCREX, which performs INCR and EXPIRE in a single atomic call. Benchmarks show a 1.6–2x speedup from saving one round trip, dropping to 9–21% when pipelined. The main benefit is eliminating the window where a crash left a counter without a TTL.
- INCREX key [NX|XX] [EX|PX|EXAT|PXAT] [BYINT|BYFLOAT] atomically increments and sets TTL
- 1.6–2x faster than INCR+EXPIRE, but only 9–21% when pipelined
- In a 500-request crash simulation: 11 orphaned keys without TTL vs 0 with INCREX
- NX/XX flags apply to key existence, not TTL presence, following SET's convention
Read next
Software