7

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:

  1. Key Value is developed for stable message streaming
  2. 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:

  1. 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.
  2. Basic caching, reading once from the database and cache the read value for 30 seconds
Arnold Zahrneinder
  • 4,788
  • 10
  • 40
  • 76
  • Curious if you ever went ahead with this. We don't implement Redis but are thinking about using the KV store along with notifications to implement caching. Basically cache locally and in the KV store and watch for updates to refresh the local caches. – AlexGad Apr 25 '23 at 23:53
  • @AlexGad: I have already move on with this and so far everything is so good. The only disadvantage is that, Redis comes with a client that you can use to browse keys or manually delete them. NATS doesn't have anything like that, at least as far as I know. – Arnold Zahrneinder Apr 27 '23 at 02:50
  • The nats-cli https://github.com/nats-io/natscli can do this – b2f Aug 03 '23 at 14:24

0 Answers0