Is it possible to use Redis Timeseries with TimescaleDB and use Redis Timeseries as a cache for faster retreival?

I’m trying to use redis to cache time series data of 270 stocks. Every second or so I get an array of stock changes (trades) that have just happened. I want to save this data in redis so I’m currently trying to think of the best (and most efficient) way to do so. Is it possible to use Redis cache with TimescaleDB and use Redis cache as a cache for faster retreival?

Hi @andynatty welcome to the community :wave:

I think this possibly fits into our “given” response that TimescaleDB is packaged as an extension to PostgreSQL. As such, if you can achieve something with Postgres then in principle you should be able to achieve it with TimescaleDB. I found a couple of articles such as this one that suggests this can be done, but I appreciate that’s an oldish text.

I couldn’t find anything in Timescale’s docs about it, but I’ll ask the team if they have any further input (especially if they know the answer one way or another). If nothing arises, though, it might be one of those times to say “would you be able to try and let us know how it goes” :pray:

Thank you @LorraineP for your quick reply, I will try from my end and also please let me know if you hear anything from the team.

1 Like

Hi, welcome to the Timescale community!

It’s not something we support natively (as in there isn’t anything in Timescale which will set the Redis key for you), but if you wanted to have Redis as a cache in front of Timescale you could do that either in your application as you persist trades (which would be faster and easier), or from the database using a trigger or a scheduled job (which would be slower and more complex, but probably still fine depending on volume).

Is the desire simply to make last price lookup super fast, or is it because your apps already talk to Redis?