How can I access memcached using javascript?

Let's say I have a working memcached deamon on the server. Let's say that this server is capable of handling server side Javascript ( APE in my case).

Accessing memcached with some Javascript on the server should be easy (I mean, in my opinion ...).

But I have to admit that my idea is ending ...

"Help plz"? :)

thank

EDIT:

It works:

Ape.registerCmd("CMD", true, function(params, infos) {
Ape.log("cmd called");

var socket = new Ape.sockClient("11211", "127.0.0.1", {flushlf: true});

socket.onConnect = function() {
    Ape.log("Connected to Memcached");
    Ape.log("Issued 'stats' commande to Memcached...");
   this.write("stats\n");
    this.onRead = function(data) {
        Ape.log("Data from memcached : " + data);
    }
}
//data = ...
infos.sendResponse('return', {'data':data});
});
+5
source share
3 answers

You are talking to memcached via a socket, so if there is a socket API on any server in your JavaScript, you can write a memcached client for it.

javascript C, , JavaScript.

+2

, memcache JavaScript. jsmemcached, .

+1

silkjs has a built-in memcache mechanism.

Here is the documentation: http://silkjs.org/documentation/Memcached

0
source

All Articles