redis 127.0.0.1:6379> SET KEY VALUE [EX seconds] [PX milliseconds] [NX|XX]
EX seconds
- Sets the specified expiration time (in seconds).PX milliseconds
- Sets the specified expiration time (in milliseconds).NX
- only if there is no key set key.XX
- Only if there is provided in the key.
Examples
redis 127.0.0.1:6379> SET mykey "redis" EX 60 NX
OK