Redis Commands
- A
- B
- Client
-
Cluster
- Cluster-addslots
- Cluster-addslotsrange
- Cluster-bumpepoch
- Cluster-count-failure-reports
- Cluster-countkeysinslot
- Cluster-delslots
- Cluster-delslotsrange
- Cluster-failover
- Cluster-flushslots
- Cluster-forget
- Cluster-getkeysinslot
- Cluster-help
- Cluster-info
- Cluster-keyslot
- Cluster-links
- Cluster-meet
- Cluster-myid
- Cluster-myshardid
- Cluster-nodes
- Cluster-replicas
- Cluster-replicate
- Cluster-reset
- Cluster-saveconfig
- Cluster-set-config-epoch
- Cluster-setslot
- Cluster-shards
- Cluster-slaves
- Cluster-slots
- Cluster
- Command
- Config
- D
- E
- F
- G
- H
- I
- K
- L
- M
- O
- P
- Q
- R
- S1
- S2
- T
- U
- W
- X
- Z1
- Z2
Docs > Redis Commands > G > Getex
Get the value of key
and optionally set its expiration.
GETEX
is similar to GET
, but is a write command with additional options.
Options
The GETEX
command supports a set of options that modify its behavior:
EX
seconds -- Set the specified expire time, in seconds.PX
milliseconds -- Set the specified expire time, in milliseconds.EXAT
timestamp-seconds -- Set the specified Unix time at which the key will expire, in seconds.PXAT
timestamp-milliseconds -- Set the specified Unix time at which the key will expire, in milliseconds.PERSIST
-- Remove the time to live associated with the key.
@return
@bulk-string-reply: the value of key
, or nil
when key
does not exist.
@examples
SET mykey "Hello"
GETEX mykey
TTL mykey
GETEX mykey EX 60
TTL mykey