Lokinder Singh Chauhan
Lokinder Singh Chauhan

Reputation: 2686

What is the best solution for caching in clustered Node Js application?

I used cluster-node-cache with following code.

var obj = { my: "Special", variable: 42 };
        cache.set("myKey", obj).then(function(result) {
                console.log(result.err);
                console.log(result.success);

                cache.get("myKey").then(function(result2) {
                    console.log(result2.err);
                    console.log(result2.success);
                });

        });

This resulted in following output

null
true
null
undefined

Certainly, with this result, cluster-node-cache is not a solution for caching requirement with cluster.
Please suggest best solution and why that solution is best?

Upvotes: 0

Views: 2189

Answers (1)

Lokinder Singh Chauhan
Lokinder Singh Chauhan

Reputation: 2686

Since memory data is not shared among different processes, cluster cache does not seems to solve problem of caching in clustered nodejs application.

I solved this caching issue with redis server. redis server have good performance and it can be clustered further(for bigger applications)

Upvotes: 1

Related Questions