You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
added handy example of using sort command using code posted by linus in mranney/node_redis/#103
This commit is contained in:
17
examples/sort.js
Normal file
17
examples/sort.js
Normal file
@@ -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
|
Reference in New Issue
Block a user