seaguest/cache

update function

Closed this issue · 1 comments

In my understanding cache aside should first update the database when updating the data and then delete the data in the cache. I don't see the update function in the code

Firstly you can update the db, then call cache.Delete(key) (delete all cache items impacted by the db change ) to delete cache, then next cache.GetObject will load the updated value.
because update logic is not a major concern in a cache framework, a db record change could impact multiple cache items, it is not practical to write an update function for each cache item.