We usually store our data in a relational databases for persistency.But what do we really do for prevent performance problems in high traffic applications? We develop faster and more robust applications by using caching.On the other hand, We usually use cache-aside programming pattern.
Lets assume that,
We use the following algorithm to get data at any point in the application.
- check local memory
- else check redis, and update local memory
- else fetch from source, and update redis and local memory
What are we going to do with any data change in the source? How do we keep our memory fresh?
At this point, redis will save us.
let’s look at the solution below
I will share the source at github as soon as possible.