You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the protocol response from the server has changed slightly for the keys function (and possibly others untested). Where our old servers (1.2.1) used to say this;
KEYS *
$3
foo
... the new server (1.3.4) says this;
KEYS *
*1
$3
foo
I think it is preceding the #bytes with the #responses, in this case 1. What this means for the lambda called from RESPONSE_CALLBACKS for keys, is that it gets a list and attempts to split it (because it is expecting a string)
'KEYS' : lambda r: r and r.split(' ') or [],
To see it in action, start up a 1.3.4 server (got mine from github), crank up a python interpreter, and fire away;
r.keys('*')
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.linux-x86_64/egg/redis/client.py", line 440, in keys
File "build/bdist.linux-x86_64/egg/redis/client.py", line 284, in format_inline
File "build/bdist.linux-x86_64/egg/redis/client.py", line 220, in execute_command
File "build/bdist.linux-x86_64/egg/redis/client.py", line 215, in _execute_command
File "build/bdist.linux-x86_64/egg/redis/client.py", line 269, in parse_response
File "build/bdist.linux-x86_64/egg/redis/client.py", line 181, in
AttributeError: 'list' object has no attribute 'split'
I'm in the process of porting some code from 0.6.3(?) because you now have pipelining (yay), but this is a bit of a bu99er because I use the keys call a lot. It is possible that other calls I haven't come across could be affected by this variation in protocol response.
Cheers
Sam
The text was updated successfully, but these errors were encountered:
No worries. I would caution you though -- keys() isn't an efficient operation on the redis server side. It's literally scanning all keys to check if the particular pattern matches each one. If you can figure out how to group your keys, perhaps in a number of sets, then use SMEMBERS to get all the keys from a specific set, you'd be much better off.
Ahh yes. At the client end I use redis as a kind of volatile configuration/ IPC type instance on a host with a collection of processes sharing the instance. It means there are less than a hundred keys of varying types - even less now with hash support. Mostly it is depth rather than breadth. Looking forward to hkeys, hvalues, and hitems or whatever they get called =]
It looks like the protocol response from the server has changed slightly for the keys function (and possibly others untested). Where our old servers (1.2.1) used to say this;
KEYS *
$3
foo
... the new server (1.3.4) says this;
KEYS *
*1
$3
foo
I think it is preceding the #bytes with the #responses, in this case 1. What this means for the lambda called from RESPONSE_CALLBACKS for keys, is that it gets a list and attempts to split it (because it is expecting a string)
'KEYS' : lambda r: r and r.split(' ') or [],
To see it in action, start up a 1.3.4 server (got mine from github), crank up a python interpreter, and fire away;
I'm in the process of porting some code from 0.6.3(?) because you now have pipelining (yay), but this is a bit of a bu99er because I use the keys call a lot. It is possible that other calls I haven't come across could be affected by this variation in protocol response.
Cheers
Sam
The text was updated successfully, but these errors were encountered: