Redis 8 · Keys and strings

Set only if the key does not exist

Useful as a simple lock. Returns nil if the key exists.

SET lock:job1 1 NX EX 30

Official Redis 8 documentation

More keys and strings commands

All keys and strings commands · Redis 8 cheatsheet

Was this page helpful?