-
Notifications
You must be signed in to change notification settings - Fork 0
Description
What is the best way for caching in order to increase performance in my case?
This is my own idea(i think it is the simplest way):
There are two scenarios one for writing in cache and keep it fresh and update, second for reading from cache
For reading I'm going to implement Cache-Aside, first checking cache and if data isn't there it'll get data from database and also store it in cache with a Sliding TTL approach(every time data is hit from cache,it renews TTL of data in cache)
And when data is updated in database also cache will be updated.
For eviction of articles data in cache, i think LFU (Least Frequently Used) is the best in my case(i think it is better for article management in this case to use LFU instead of LRU)
For writing data I'm going to implement write-through and write-back, write-through for articles write-back for bookmarks and likes, the difference is, Write-through is sync and after writing in cache we write it in the database immediately but Write-Back is an async approach and when it flushed data into database cache will be purged of likes and bookmarks.
I don't want to cache users data but about comments of articles , I don't know whether is it good to cache comments of articles or not
Also what is your idea about this approach?