Closed catwell closed 11 years ago
Hmmm I may be remembering it wrong but I'm pretty sure there was a point in time when Redis actually returned an empty string from RANDOMKEY
instead of a nil
... but that was probably around v0.9 or so :-) Will merge later, thanks.
Ah, maybe, I only tested on 2.6. But returning nil on the empty string is a bug IMO.
I actually hit it, because in my test suite for fakeredis I use the empty key. I found the bug by running the test suite against redis-lua instead of fakeredis.
Yep nil
should be returned only when Redis returns nil
, that is only when the database is empty. As far as I remember, storing empty keys was impossible when Redis didn't rely on the unified protocol for requests and that's why very old versions of Redis probably used empty strings to notify users in case of an empty database. It's not that we care for ancient versions of Redis to such an extent, so merging is actually fine.
Manually cherry-picked, thanks!
The empty string is a valid key in Redis.