Skip to content

arabus4chip/memcachejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Memcache.js

This is an implementation of the memcache protocol written in javascript. It uses the sockets layer as provided by the
node.js “net” module.

To use the code, you can include it as an external include directly from your project:


Memcache = require('/path/to/memcache');

Or, alternatively, you can checkout / copy the code from this repository into the node_modules subfolder of your project by hand, and include it like this:


Memcache = require('memcache')

An npm installation that will simplify inclusion is currently being worked on.

Simple usage example:


// Host and port of the constructor are optional. Default values are "localhost" and 11211. 
var connection = new Memcache(host, port);

// setting key "some_key" to the value "some_value" on the memcache server
connection.set('some_key', 'some_value');
// same with callback and additional options
connection.set('some_key', 'some_value', {
	expires:60,
	flags:0,
	callback: function () {
		// do something here
	}
});

// retrieve key "some_key" from the memcache server
connection.get('some_key', function(response) {
	if (response.success) {
		// process results, they are stored in response.data
		console.dir(response.data);
	}
});
bc. 

After you are finished getting / setting data from your server, you should tell all connections to close by issuing the @shutdown()@ command:

connection.shutdown();

This client uses connection pooling, as suggested by the memcached documentation. If you’d like to turn it off, set
Memcache.pooling to false.

About

Implementation of a memcache client written in Javascript

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%