Redis › RedisTimeSeries
How do you configure a retention period for a Redis time series so old data is automatically removed after a certain amount of time?
IntermediateAnswer
You set a retention period, specified in milliseconds, either when creating the time series or by altering it afterward, and Redis automatically removes any data points older than that configured retention window, keeping the time series from growing indefinitely while retaining only the recent history your application actually needs.
TS.CREATE sensor_data RETENTION 86400000
-- Keeps only the last 24 hours of raw dataReal-world example A high frequency sensor monitoring system configures a twenty four hour retention period for its raw data time series, automatically discarding older detailed readings while relying on downsampled aggregates for longer term historical analysis.