Retention not working when the data is not being inserted into key

Hello,

I have a question regarding retention settings.

Let’s assume I have a key where I am adding data points and it has 60 seconds retention. The retention works properly when the new data points are getting added into that key. However, at some point the user session is over and new data points are no longer being inserted into that key.

The retention seems to not work and the key with X number of data points just remains forever with keys that are over the retention period. When I test-add a dummy data point into that key Redis will actually expire old entries but it means that I need to keep track manually of all the keys and check if they should be expired or not. I was hoping that Redis could just keep retiring the data points until the data points count under a key is 0 and the key is then removed.

So my question: is RedisTimeSeries able to actually expire points under a key to which there are no more inserts? Currently, it seems that these keys are left forever eating up the memory.

RedisTimeSeries has, by design, no concept of time progression. It does not maintain an internal clock. Samples are expired based solely on the difference between their timestamp and the most recent timestamp passed to TS.ADD, TS.MADD, TS.INCRBY, and TS.DECRBY.

I guess, what you’re looking for (given the design of RedisTimeSeries), is a way to inform RedisTimeSeries about ‘your’ current timestamp. Would such feature be helpful?