cache icon indicating copy to clipboard operation
cache copied to clipboard

update function

Open guanzhanyi666 opened this issue 1 year ago • 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

guanzhanyi666 avatar Sep 03 '22 10:09 guanzhanyi666

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.

seaguest avatar Sep 03 '22 10:09 seaguest