Redundant "addedFunc" in case "LoaderFunc" call
serjk opened this issue · comments
I'm using simple gcache. I've implemented LoaderFunc and addedFunc using a database as a store.
When gcache loads a new value using LoaderFunc and set new one to a cache. Set function will call addedFunc if it exists. But the new value already exists in a db. So call "addedFunc" is redundantly in that case.
Is it expected behaviour? Does any workaround exist in such case?
Just to clarify, addedFunc
is called when you Set
a new value; loaderFunc
is called when you Get
a value that is not in the cache.
If I understand correctly, you would like to prevent execution of addedFunc
when we fallback on loaderFunc
?
Exactly, you understood correctly.