Package Exports
- memcache-parser
- memcache-parser/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (memcache-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
memcache-parser
A very efficient memcached ASCII protocol parser by using only NodeJS Buffer APIs.
Install
$ npm install memcache-parser --saveUsage
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