Comments (6)
You can't share memory between sub processes like this.
from node-cache.
You're going to have a do something at a higher level than this library if you want IPC.
from node-cache.
@soyuka @ptarjan Can you share any ideas? The main reason I use this library (node-cache) is to avoid JSON.parse + JSON.stringify (expensive in my situation).
I've thought of IPC and redis, but I only moved to this package from those because of that...
from node-cache.
You have an architecture problem not a code one. Either you want a out of process cache where you will have to serialize and deserialize somehow or you want an in-process cache which this library is. If your serialization is slow then maybe try a different serialization format like Thrift or Protobuff.
from node-cache.
@brandonros depends what you want to share, IPC is using strings, and is JSON stringifying (used EventEmitter on top of IPC here and I'm explaining it shortly).
I also wrote a blog article about a module that helps managing micro services, maybe you can look at that too.
You can use redis too, I'm using subscribe amongst lists to communicate between services and store some cached data. I try to avoid JSON.stringify
, and if you use it with redis, you may do things wrong (another blog post about indexing a hash with a set). Anyway, JSON.stringify
might not be that slow, depends mainly on the nesting of objects. As @ptarjan said you can look at other serialization ways, (msgpack, igbinary etc.).
from node-cache.
I have my server running on multiple instances and from my understanding every instance will have its own copies, how we can go and clear every instance's cache . what could be the way?
from node-cache.
Related Issues (20)
- Npm test stuck if cache is used with TTL HOT 1
- Adding support for array values HOT 2
- Singleton on cluster mode HOT 3
- how do i get cache and update time expired? HOT 1
- size and memsize gives always 0 result HOT 1
- cache key length limit HOT 1
- Graphql result sometimes broken
- RangeError: Maximum call stack size exceeded HOT 2
- Cache per req.body variable
- Item written to cache by Nextjs middleware doesn't exist when reading from the cache HOT 2
- If the cache timeout is sufficiently big, it doesn't work. HOT 3
- Does it auto clean HOT 2
- How can I cache a third party json? HOT 1
- README typo
- calling put with TTL value within Promise chain fails HOT 5
- keys() writes checks that get() can't cash
- support more operation maybe better
- Is this a bug about `this.del` function HOT 2
- Data not cached HOT 1
- Is this library a good replacement for localstorage and session storage for security HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-cache.