Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion/Question: Wouldn't be better to use ioredis instead of redis package? #60

Closed
damianof opened this issue May 22, 2015 · 3 comments

Comments

@damianof
Copy link

ioredis seem to perform far better then redis
(https://github.com/luin/ioredis)

@msamblanet
Copy link

I am using ioredis with this package. There was a small monkey-patch I had to do to ioredis to make it work. ioredis returns buffers via pmessageBuffer instead of pmessage. The snippet below is a hack I used on the sub instance to make work with socket.io-redis. The return_buffers and detect_buffers flags are not needed.

While more direct support of ioredis (which is much more current and actively maintainted) would be nice, this seems to be sufficient for my applicaiton's needs.

// WARNING: Use of this will prevent message and pmessage handlers from being unregistered
// since our stub method will be registered instead...
var oldOn = redisClient.on;
redisClient.on = function(event, oldListener) {
    var self = this;
    switch (event) {
        case "pmessage":
            return oldOn("pmessageBuffer", function() {
                if (arguments.length > 1) arguments[1] = arguments[1].toString();
                return oldListener.apply(self, arguments);
            });

        case "message":
            return oldOn("messageBuffer", function() {
                if (arguments.length) arguments[0] = arguments[0].toString();
                return oldListener.apply(self, arguments);
            });

        default: return oldOn.apply(self, arguments);
    }
}

@mindfireon812
Copy link

Any Update ?

@darrachequesne
Copy link
Member

Closed by #95.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants