redis-sync
redis-sync copied to clipboard
Support for Redis connections that require auth? Parse args into strings/json?
Would it be possible to support redis connections that need auth by allowing credentials to be passed into redis-sync?
Also, is it possible to parse the key being acted into a string on from the args? And parsing the data being set into a string/object from the args?
Thanks for the cool lib!
Hi aliasone, thanks for your suggestions and for your interest in redis-sync.
Regarding auth support, that's something I've been meaning to add at some point. It hasn't been a priority as I haven't had a need for it myself yet and nobody had requested it so far. But you can now expect it in the next release.
I've been also pondering over whether to decode key names and values. Currently you get raw buffers and need to decode yourself. I absolutely want to keep the flexibility of passing raw buffers - for binary data - but almost all the use cases I've seen end up treating at least the key name as a string, so some kind of option to decode would make redis-sync (and rdb-parser) easier to use. So that's another one for the next release.
Awesome, yes this would make redis-sync a perfect fit for what I'd like to use it for.
Edit: Oh, I also didn't know buffers had a toString()
method. That simplifies things a bit.
Thanks!
you also need to concatenate the buffers. note that you get passed an array of buffers rather than just a buffer
require("bufferjs"); // there are other libraries out there for this, I tend to use this one sync.on('command', function(command, args) { var key = Buffer.concat(args[0]).toString(); });
if you just use args[0].toString() it will work for the fairly common case of a array with a single Buffer, but you will end up with mysterious commas in the middle of the string now and then
just made a quick npm release to fix urgent issues on OS X with node.js 0.8.x this comes next