Skip to content

Commit

Permalink
Adding a keys command
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-singer committed Apr 28, 2012
1 parent 84e9f05 commit 18c4736
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/curlTest.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
curl -v -H "Content-Type: application/json" -X POST -d '{"ping":[""]}' http://127.0.0.1:8082/exec
curl -v -H "Content-Type: application/json" -X POST -d '{"keys":["*"]}' http://127.0.0.1:8082/exec
15 changes: 15 additions & 0 deletions server/redis_web_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ Future execRedis(HttpRequest req,HttpResponse res,var data) {
String cmd = commands["cmd"];
redis.Connection conn;
switch(cmd) {
case "keys":
conn = new redis.Connection();
conn.connect().then((connected) {
if (connected == true) {
conn.SendCommand('KEYS', commands["args"]).then((ret) {
m["result"] = ret;
var retStr = JSON.stringify(m);

res.outputStream.writeString(retStr);
completer.complete(null);
});
}
});
break;

case "get":
conn = new redis.Connection();
conn.connect().then((connected) {
Expand Down

0 comments on commit 18c4736

Please sign in to comment.