SET
Syntax
SET key value [NX | XX] [GET] [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL] [FLAGS flags] [CAS cas]
Description
Insert or replace an entry into cache.
Options
NX- Only store the entry if it does not already exist.XX- Only store the entry if it already exists.EX seconds- Give the entry a TTL, in seconds.PX milliseconds- Give the entry a TTL, in milliseconds.EXAT unix-time- Give the entry a TTL, provided as an absolute Unix time in seconds.PXAT unix-time-milliseconds- Give the entry a TTL, provided as an absolute Unix time in milliseconds.KEEPTTL- Keep the existing TTL already assigned to entry.GET- Return the old value for key.
Example
> SET user:first Tom
> SET user:last Anderson
> SET user:pos "-112.8293,33.19572" EX 60
# After 60 seconds have elapsed ...
> MGET user:first user:last user:pos