Answer the question
In order to leave comments, you need to log in
How to arrange synchronization of MongoDB and REDIS?
So, we have a NodeJS + Nginx webserver, and a redis database that pulls data from MongoDB.
The task is this: to force redis to update the cache when changes are made to Mongo, the database is edited directly from another server.
I see the following options:
1. Transfer the database update through the web api. Then NodeJS will pull redis for updates.
2. Periodically force redis to be cached again.
3.Rewrite or customize the MongoDB event handler.
Who faced?
What decision was made and how was it implemented?
Answer the question
In order to leave comments, you need to log in
Invalidate the radish cache as soon as you change the data in mongodb with a single request to the north, if you cannot predict how often the data will be updated, for example in a minute or a week. If you can, then approach #2, taking into account the average time to update records in the main database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question