TS.RETENTION
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.
Return value
Section titled “Return value”| 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.
Examples
Section titled “Examples”127.0.0.1:6379> TS.CREATE temp:kitchenOK127.0.0.1:6379> TS.RETENTION temp:kitchen 86400000OK127.0.0.1:6379> TS.RETENTION temp:garage 86400000(error) ERR series not foundCompatibility
Section titled “Compatibility”HotKV-only command. RedisTimeSeries changes retention with TS.ALTER.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.