-
Notifications
You must be signed in to change notification settings - Fork 138
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
share the same cache between 2 nodejs script #61
Comments
Thats not possible. It's a planned feature to define a storage provider like process memory, a file or a external server solution. But for now I recommend using a memcached or redis server that's saving your data. |
Would there be any security or performance issues with putting a cache instance on app.locals in an express app? |
@CalebEverett node-cache for itself has no security built in. |
What happens if you run nodecache in an app running in cluster mode, say, like in pm2? Does this mean that each thread will have its own cache? |
@amenadiel Cluster mode or event pm2 cluster ist currently not development target and is not tested yet. Fell free to check it and tell me the results or send me a PR ;-) |
How to access the same cache in a different module? Seems pointless to have a cache just for one file. (same app) Tnx |
@cjaoude you write one singleton module that exports a cache instance and import that one instance everywhere you want to use it. Example: ./src/cache.js:
./src/a.js
./src/b.js
This is not specific to NodeCache but more how the node.js module system works. Read more at: https://nodejs.org/dist/latest-v10.x/docs/api/modules.html |
I see, thanks, that makes sense. @erdii |
I set a cache key and store a value in one nodejs script. How do I use the same key and access the value in another nodejs script? Right now, it will say key_not_found in another script.
The text was updated successfully, but these errors were encountered: