Okay I know I asked about this before, and the answer was basically cache data that doesn't change often.
Well what does one do when at least 99.9% of the data changes?
In my project the only tables that doesn't get updated or won't get updated frequently would be the member profile info (name/address, and settings)
So how does one still enable some kind of caching but keep and make sure the data being viewed is updated when changes are applied?
General Cache Use Cases In-memory data lookup: If you have a mobile / web app front end you might want to cache some information like user profile, some historical / static data, or some api response according to your use cases. Caching will help in storing such data.
Write-through. In a write-through cache, the cache is updated in real time when the database is updated.
Write-through ensures that data is always fresh, but can fail with empty nodes and can populate the cache with superfluous data.
I guess, it's not really 99.9% of all data that changes, but it's in 99.9% of all data locations that changes happen.
For example, if you are running a bulletin board, that means that there will be a steady stream of new posts, but old posts will remain the same, and even old threads will stay unchanged for a long, long time.
In that case, you'll need a way to invalidate old cached data, so that you can build a cache as soon as a thread (in the example) is viewed. If there is a change to ONE of these threads (i.e. when someone adds a new post), this one cached item is deleted/marked outdated, so the next time it is viewed, it will be rebuilt. Other items that still haven't changed will use the cache, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With