Permalink
Browse files

added handy example of using sort command using code posted by linus …

…in mranney/node_redis/#103
  • Loading branch information...
1 parent 3e95c55 commit 804970f8956d81c1d46bd0e848c2cc0bfd9a022f @maks maks committed Oct 27, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 examples/sort.js
View
@@ -0,0 +1,17 @@
+var redis = require("redis"),
+ client = redis.createClient();
+
+client.sadd("mylist", 1);
+client.sadd("mylist", 2);
+client.sadd("mylist", 3);
+
+client.set("weight_1", 5);
+client.set("weight_2", 500);
+client.set("weight_3", 1);
+
+client.set("object_1", "foo");
+client.set("object_2", "bar");
+client.set("object_3", "qux");
+
+client.sort("mylist", "by", "weight_*", "get", "object_*", redis.print);
+// Prints Reply: qux,foo,bar

0 comments on commit 804970f

Please sign in to comment.