1.0.1 • Published 2 years ago
memcache-parser v1.0.1
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; // unknown command
}
}
receiveResult(result) {
// result: { data, cmd, cmdTokens }
// cmd: the command that initiate the result data
// cmdTokens: the tokens of the original command line
// data: the data for the command cmd
}
}
See memcache-client for more example usage
License
Apache-2.0 © Joel Chen
1.0.1
2 years ago
1.0.0
2 years ago
0.2.8
6 years ago
0.2.7
7 years ago
0.2.6
7 years ago
0.2.5
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.7
7 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago