I am working on a project that has some gamefication features, including a leaderboard. The project uses a MongoDB database, and I store in it user points and xp. After a short research, I found out that Redis is a perfect solution for leaderboards because of the speed. However, I dont really understand how to integrate Redis into my current stack, because whenever a user has points to be updated, I should also update the Redis db, so I can have a real time leaderboard. Because of that, I am not sure how I can guarantee data consistency between both databases.
What are your thoughts on that ? Do you know a good way to implement this ? Are there any useful resources / examples I can check