Implementing a PHP compatible memcache client for node.js
I'm trying to implement another pure javascript memcache client for node.js.
The question is that I have to get keys which were set by P开发者_JS百科HP Memcache class from multipule memcache server, but I can't figure out how PHP hashes those keys.I have looked for the Memcache class manual:
http://www.php.net/manual/en/memcache.ini.phpthe "memcache.hash_function" is "crc32", but I still have no idea how to determine which server to set from a crc32 hash.
Is there some docs or references?
Thanks in advence.The information will be housed in PECL: http://pecl.php.net/package/memcache
To find out the details you will most likely need to review the source of the extension.
I used http://search.npmjs.org/#/memcache via npm. Works fine across node.js and php(with the 'memcached' mod not 'memcache').
The documentation is sparse though.You can use the code below to get started.
var memcache = require('memcache');
var client = new memcache.Client(11211, '127.0.0.1');
client.connect();
client.get('aaa', function(error, result){
console.log(result);
// all of the callbacks have two arguments.
// 'result' may contain things which aren't great, but
// aren't really errors, like 'NOT_STORED'
});
精彩评论