UNPKG

memcached

Version:

A fully featured Memcached API client, supporting both single and clustered Memcached servers through consistent hashing and failover/failure. Memcached is rewrite of nMemcached, which will be deprecated in the near future.

18 lines (13 loc) 582 B
var nMemcached = require( '../' ), fs = require('fs'), memcached; // connect to our memcached server on host 10.211.55.5, port 11211 memcached = new nMemcached( "10.211.55.5:11211", { compressionThreshold:10 } ); fs.readFile( __dirname + '/binary/hotchicks.jpg', function( err, data ){ if( err ) console.error( err ); memcached.set( "hello_binary", data, 10000, function( err, result ){ if( err ) console.error( err ); console.dir( result ); memcached.end(); // as we are 100% certain we are not going to use the connection again, we are going to end it }); });