I want to know if there is a good driver or native implementation to connect node.js directly to memcached.
3 Answers
Here's my experience of using couple of node-memcached modules
3rd-Eden/node-memcached. The project doesn't seem to be stable and has bugs with storing BLOBS (see issue #46 and issue #48 for details). Moreover I found it's code quite hard to read (and thus hard to update), so I wouldn't suggest using it in your projects.
elbart/node-memcache seems to work fine, and I feel good about the way it's source code is written, but it doesn't support storing BLOBs (there's a fork that is said to add the ability, but I haven't tested it)
overclocked/mc is the one I like a lot. This is the only one that is capable of storing BLOBs. It has nice documentation, its code looks good and it is easy-to-use.
Currently I use overclocked/mc in my project and everything seems to be working fine.

- 3,143
- 3
- 22
- 21
-
6overclocked/mc seems to be at http://overclocked.com/mc and https://github.com/jackyz/mc now – choonkeat Nov 04 '13 at 02:24
-
'memjs' for the win https://github.com/memcachier/memjs – Feu Jun 19 '18 at 04:16
Use the search on: https://npmjs.org/
If you don't have npm, install it.
On the cli:
npm search memcache
Brings up 5 modules.
This seems to be the most popular: https://github.com/3rd-Eden/node-memcached

- 30,681
- 3
- 39
- 60

- 12,602
- 2
- 41
- 47
-
lmgtfy is deprecated. This isn't a feed vs fish question - it's a request, however subjective, on what are good memcached modules. btw npm search
is always super slow. – ekeyser Mar 31 '16 at 21:57 -
I found working demo at https://jsonworld.com/demo/how-to-implement-memcached-in-nodejs-application – Pankaj Apr 13 '19 at 13:43
The basic idea.
net = require("net");
var client = net.connect({port: 11211, host:"localhost"},function() {
console.log('connected');
client.write('stats\r\n');
//OR other commands + "\r\n"
client.on('data', function(data) {
console.log(data.toString());
});
client.on('end', function() {
console.log('data fetched');
});
});
Also you can use net.createServer to make your own memory cache server to support additional requirements such as PERSISTENT YOUR CACHE DATA TO MYSQL.

- 940
- 11
- 16