Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

TS.RETENTION

Last updated
TS.RETENTION key milliseconds
Group
Time series
Complexity
O(M), M being the samples dropped
Arity
3 (exactly, counting the command name)
Flags
write, fast
Keys
first 1, last 1, step 1
HotKV Cloud
Performance and Scale
On-Premise
requires the time-series license feature

TS.RETENTION sets the retention period of the time series key. Samples older than milliseconds before the server’s current time are dropped at once, and again each time a sample is added. 0 keeps samples forever.

Case RESP2 RESP3
Set Simple string OK Simple string OK

Error replies: ERR series not found, ERR invalid retention value for a value that is not a non-negative integer, and NOLICENSE ... without the time-series license feature.

127.0.0.1:6379> TS.CREATE temp:kitchen
OK
127.0.0.1:6379> TS.RETENTION temp:kitchen 86400000
OK
127.0.0.1:6379> TS.RETENTION temp:garage 86400000
(error) ERR series not found

HotKV-only command. RedisTimeSeries changes retention with TS.ALTER.

TS.CREATE, TS.INFO