I've had the pleasure of working a bit with Salvatore for the past few months learning the ropes of Redis and C, and one of the results of this collaboration is
Cthulhu, a JavaScript interpreter for Redis. Basically, it allows you to write a Redis module in JavaScript. The Redis module API is supported and exposed through an object oriented interface.
You can get started by
following the super simple instructions on github.
What can you do with Cthulhu? For example, you can manipulate any object in the Redis DB. For example, here's how to create a function to delete the top values of a Sorted Set:
function DeleteTop(name, num) {
var set = new Redis.SortedSet(name);
var i = 0;
var range = set.getRange();
range.each(function(elem){
if (i++<num) {
set.remove(elem.key);
}
});
}
You can put this in a file called deleteTop.js, load it with cthulhu into Redis and you will have a new command available: INVOKE DeleteTop <name> <num>.
I'm looking for feedback, bug reports but also feature requests. If you find this useful, fantastic! If you want to help, that'd be awesome!