-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix bug in cluster mode. #14
base: master
Are you sure you want to change the base?
Conversation
Fix bug when operating in cluster mode.
Update index.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cacheman-file
is meant to be a local temp file store. It sounds like a better solution to store data in a cluster (as you're doing) would be redis
. Try to not have the get
function set data when possible. It goes against having a RESTful API. Also there are cases where data
may be an empty object. Check out https://github.com/anaptfox/cacheman-file/blob/master/index.js#L52
If you can, add a failing test that describes your scenario and then some code changes to have it covered.
Thanks for the comment and it was very helpful. General Architecture of Storage in Question: "cacheman-file is meant to be a local temp file store" as long as it works! 👍 I completely agree with you that redis is clearly the best solution but that doesn't mean that file can't be a solution :) It fails for multi-instances in same app and clusters too. |
Hi
this.cache is bind to a cluster, This means, if this.cache is updated on different cluster, key may not present in other clusters and hence returns an empty response. Consider I have two clusters, A and B
A = B = OLD
A sets the new data and updates itself as A = NEW but B doesn't update since despite it is reading from file, it relying on this.cache key exist or not.