Caching and messaging

Redis SET EX

Set string and expiry in one command. Source-reviewed integration fragment or manual procedure, NOT RUN.

Formal Syntax & Structure

java syntaxjava
SET lab:tenant-a:B1 5 EX 60

Working Example

Example Snippetjava
# Individual redis-cli commands on a disposable Redis 7.4 instance.# Not a shell script; run one line at a time after connecting to the isolated lab.SET lab:tenant-a:B1 5 EX 60GET lab:tenant-a:B1TTL lab:tenant-a:B1SET lab:tenant-a:B1 6 KEEPTTLTTL lab:tenant-a:B1DEL lab:tenant-a:B1TTL lab:tenant-a:B1
Java Reference