admin管理员组文章数量:1328315
Let's say I have a working memcached deamon on a server. Let's say that this server is able to handle server side Javascript (APE in my case).
It should be easy to access memcached with some Javascript right on the server (I mean, in my mind...).
But I've to admit I'm running out of idea...
"Help plz" ? :)
Thanks
EDIT :
This is working :
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' mande to Memcached...");
this.write("stats\n");
this.onRead = function(data) {
Ape.log("Data from memcached : " + data);
}
}
//data = ...
infos.sendResponse('return', {'data':data});
});
Let's say I have a working memcached deamon on a server. Let's say that this server is able to handle server side Javascript (APE in my case).
It should be easy to access memcached with some Javascript right on the server (I mean, in my mind...).
But I've to admit I'm running out of idea...
"Help plz" ? :)
Thanks
EDIT :
This is working :
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' mande to Memcached...");
this.write("stats\n");
this.onRead = function(data) {
Ape.log("Data from memcached : " + data);
}
}
//data = ...
infos.sendResponse('return', {'data':data});
});
Share
Improve this question
edited Oct 14, 2014 at 15:15
FeliceM
4,21911 gold badges51 silver badges77 bronze badges
asked Feb 7, 2011 at 13:48
bPizzibPizzi
1,0251 gold badge9 silver badges12 bronze badges
3 Answers
Reset to default 3You talk to memcached over a socket, so if whatever server runs your JavaScript has a socket API you can write a memcached client for it.
If you can write javascript modules in C you can also do it, even if you don't have socket support in JavaScript.
It seems that there already exist memcache clients for JavaScript. You could try jsmemcached for example.
silkjs has a memcache mechanism built in it.
Here is the documentation: http://silkjs/documentation/Memcached
本文标签: How can I access memcached with JavascriptStack Overflow
版权声明:本文标题:How can I access memcached with Javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742221753a2435489.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论