GithubHelp home page GithubHelp logo

Comments (6)

soyuka avatar soyuka commented on June 29, 2024

You can't share memory between sub processes like this.

from node-cache.

ptarjan avatar ptarjan commented on June 29, 2024

You're going to have a do something at a higher level than this library if you want IPC.

from node-cache.

brandonros avatar brandonros commented on June 29, 2024

@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.

ptarjan avatar ptarjan commented on June 29, 2024

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.

soyuka avatar soyuka commented on June 29, 2024

@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.

arnavyagnikoyo avatar arnavyagnikoyo commented on June 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.