My favorites | Sign in
Project Logo
                
Code license: New BSD License
Labels: javascript, jaxer, memcached
Show all Featured wiki pages:
Usage
People details
Project owners:
  rakeshpai

JSMemcached Client

This project aims to create a feature complete JavaScript client for memcached that can be used over Jaxer.

Dependencies

Setup

Firstly, include the script.

<script type="text/javascript" src="path/to/jsMemcached.js" runat="server"></script>

Note: runat attribute can only have the value "server". Anything else will be very funny.

Alternatively, if you are using jsMemcached-extension.js, you simply have to drop the file into your jaxer installation's extensions folder, restart Jaxer Manager, and you are set.

Usage

Firstly, configure JsMemcached to work with your server. To do this, you should simply call .configure on the JsMemcached object, and pass it your memcache server host and port. For jsMemcached.js:

JsMemcached.configure("localhost", 11211);

For jsMemcached-extension.js:

Jaxer.memcached.configure("localhost", 11211);

The operations on JsMemcached and Jaxer.memcached are identical. For brevity from this point on, we'll use the term JsMemcached for both objects. All the methods described below can also be applied to Jaxer.memcached.

To save a value to memcached, simply use the following code:

JsMemcached.set("keyName", "Value here, as long as you want");

To retrieve the value:

JsMemcached.get("keyName");

To cleanup, whenever you are done with the JSMemcached object, you should call:

JsMemcached.close();

Note that there's no corresponding .open() method to open a connection to the memcached server. Connections are lazy-opened when the first write/retrieval call is made. Once that's done, the connection is held open till .close() is called.

Features

Known issues









Hosted by Google Code