We are currently using Redis behind NATS to do caching which is a standard practice. However, I have come across this idea that we can take advantage of the Object Store or Key Value features in NATS to implement caching natively. However, I know that:
- Key Value is developed for stable message streaming
- Object Store is developed for chunking large data so that we don't need to change the max 1 Mg message configuration
On the other side, all these have TTL for data which is favorable.
My question is that, is it technically correct to replace the current Redis cache which we have behind NATS with the JetStream?
Some possible scenarios we are handling:
- Reading a large amount of data and applying pagination on that which is currently done in Redis, but I am thinking about using the object store for that.
- Basic caching, reading once from the database and cache the read value for 30 seconds