bwlewis / rredis

R client for Redis
http://illposed.net/
93 stars 25 forks source link

redisIncr problem #2

Closed daroczig closed 12 years ago

daroczig commented 13 years ago

In the manual it says that calling redisIncr after redisSet could be easily done. The example from the manual does not seems to work though:

> redisSet('foo', 1)
[1] "OK"
> redisIncr('foo')
Error in .getResponse() : ERR value is not an integer or out of range

If I set the integer value from command line (with redis-cli) the redisIncr works like a charm so it seems that the redisSet does not save the value as integer but as R object? From command line the saved foo (set to: 1) looks like:

"X\\x00\x00\x00\x02\x00\x02\\x00\x00\x02\x03\x00\x00\x00\x00\x0e\x00\x00\x00\x01?\xf0\x00\x00\x00\x00\x00\x00"

If I set the value with charToRaw, it seems to work:

> redisSet('foo', charToRaw('1'))
[1] "OK"
> redisIncr('foo')
[1] 2

The documentation might be updated if my findings look right.

bwlewis commented 13 years ago

Thank you. We changed redisIncr in a recent revision and I forgot to update the manual.

I'll fix that as you suggest in the devel code on github for inclusion in the next cran version.

Thanks,

Bryan On Jun 22, 2011 7:36 AM, "daroczig" < reply@reply.github.com> wrote:

In the manual it says that calling redisIncr after redisSet could be easily done. The example from the manual does not seems to work though:

redisSet('foo', 1) [1] "OK" redisIncr('foo') Error in .getResponse() : ERR value is not an integer or out of range

If I set the integer value from command line (with redis-cli) the redisIncr works like a charm so it seems that the redisSet does not save the value as integer but as R object? From command line the saved foo (set to: 1) looks like:

"X\x00\x00\x00\x02\x00\x02\x00\x00\x02\x03\x00\x00\x00\x00\x0e\x00\x00\x00\x01?\xf0\x00\x00\x00\x00\x00\x00"

If I set the value with charToRaw, it seems to work:

redisSet('foo', charToRaw('1')) [1] "OK" redisIncr('foo') [1] 2

The documentation might be updated if my findings look right.

Reply to this email directly or view it on GitHub: https://github.com/bwlewis/rredis/issues/2