Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant "addedFunc" in case "LoaderFunc" call #36

Open
serjk opened this issue Jun 14, 2017 · 2 comments
Open

Redundant "addedFunc" in case "LoaderFunc" call #36

serjk opened this issue Jun 14, 2017 · 2 comments

Comments

@serjk
Copy link

serjk commented Jun 14, 2017

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?

@serjk serjk changed the title Redundant "addedFunc" call Redundant "addedFunc" call in case LoaderFunc call Jun 14, 2017
@serjk serjk changed the title Redundant "addedFunc" call in case LoaderFunc call Redundant "addedFunc" in case "LoaderFunc" call Jun 14, 2017
@erwanor
Copy link
Contributor

erwanor commented Jun 14, 2017

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?

@serjk
Copy link
Author

serjk commented Jun 15, 2017

Exactly, you understood correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants