djveremix / redis

Automatically exported from code.google.com/p/redis
0 stars 0 forks source link

LRANGE returning multi-bulk length 0 instead of -1 on non-existent keys in 2.0.0-rc2 #271

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The protocol specification states that multi-bulk replies will have a special 
length of -1 if the key doesn't exist. It gives the following example:

  C: LRANGE nokey 0 1
  S: *-1

Redis 1.2 behaves this way, but it appears that behavior has changed somewhere 
along the way to 2.0.0-rc2. Now I'm getting this:

  C: LRANGE nokey 0 1
  S: *0

Is this change intentional?

Original issue reported on code.google.com by will.con...@gmail.com on 3 Jul 2010 at 11:07

GoogleCodeExporter commented 8 years ago
Probably a documentation error. The change was intentional: 
http://github.com/antirez/redis/commit/4e27f26863a237f0ddba4ee328d72f2d7e2408cc

It has to do with the fact that since Redis will delete keys for empty values 
(lists, sets and sorted sets), calling commands on non-existent keys must have 
the same result as calling the same command on an 'empty' value.

Original comment by damian.j...@gmail.com on 4 Jul 2010 at 1:25

GoogleCodeExporter commented 8 years ago
Yep the new behavior is the right one.

Thanks for reporting,
Salvatore

Original comment by anti...@gmail.com on 31 Aug 2010 at 10:58