
memcache-parser
A very efficient memcached ASCII protocol parser by using only NodeJS Buffer APIs.
Install
$ npm install memcache-parser --save
Usage
A sample connection for a memcache client to show receiving the VALUE
data from the response of a get
command.
const MemcacheParser = require("memcache-parser");
class MemcacheConnection extends MemcacheParser {
constructor(socket) {
super();
socket.on("data", this.onData.bind(this));
}
processCmd(cmdTokens) {
if (cmdTokens[0] === "VALUE") {
this.initiatePending(cmdTokens, +cmdTokens[3]);
} else {
return false;
}
}
receiveResult(result) {
}
}
See memcache-client for more example usage
License
Apache-2.0 © Joel Chen