Set a key with TTL
Set a key that expires in 1 hour (EX is in seconds)
redis-cli SET mykey 'value' EX 3600
More redis commands
-
redis-cli INCRBY counter:hits 1Atomically add 1 to an integer counter
-
redis-cli PUBLISH events '{"type":"login","user":"alice"}'Publish a message to a Redis pub/sub channel
-
redis-cli SUBSCRIBE eventsSubscribe to a channel and listen for messages
-
redis-cli INFO replicationShow the role, connected replicas and replication lag
-
redis-cli BGSAVE && redis-cli LASTSAVEStart a background RDB save and print the last save time (it changes only when BGSAVE finishes)