I am using Redis 2.2.11 with Node on Ubuntu 11.10 and I save the string, but it returns as a buffer.
id = 1234; console.log('data', data); client.hmset("user:" + id, "name", data['name'] ); client.hmget('user:' + id, "name", function(err, d) { console.log('data retrieved', d); });
The following is created in the console:
data { name: 'RealServer' } data retrieved [ <Buffer 41 6e 6e 61 52 65 61 6c 53 65 72 76 65 72> ]
Why does this happen as a string and exit as a buffer? The buffer makes debugging very difficult!
In my local setup (MacOS 10.6 with Redis 2.2.14), the resulting data prints as a string, just fine. I would like to find a solution that continues to work on both systems.
UPDATE: it also works fine without the encoding specified in CentOS 5.7. Is this something special for Ubuntu? Is there a system-wide fix?
source share