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

.getBuffer() does not work in a pipeline #223

Closed
jonathanong opened this issue Jan 4, 2016 · 1 comment
Closed

.getBuffer() does not work in a pipeline #223

jonathanong opened this issue Jan 4, 2016 · 1 comment

Comments

@jonathanong
Copy link

// ok
client.setBuffer('test', new Buffer('00ff44', 'hex'))
// ok
client.getBuffer('test')

client.multi()
  .getBuffer('test')
  .exec()
// => [ null, '\u0000�D' ]
@luin luin closed this as completed in a449415 Jan 4, 2016
@luin
Copy link
Collaborator

luin commented Jan 4, 2016

Technically the result of your get command within a transaction is QUEUED instead of 0x00ff44 (which is the result of exec command). So if you pass a callback to the getBuffer command, you will get a buffer, which value is QUEUED:

redis.multi().getBuffer('foo', function (_, res) {
  console.log(res.toString()); // res is a buffer, value is 'QUEUED'
}).exec();

I just released a new version to supports execBuffer for transactions:

redis.multi().get('foo').execBuffer();

It's a little misleading of course since the interface between transaction and pipelining are similar. I'm planning to rewrite this part to make client.multi().getBuffer('test').exec() returns a buffer and deprecate execBuffer. However I'll do it in the next major version since it breaks BC.

Let me know if anyone has any idea of it.

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

2 participants