Closed ewhac closed 10 years ago
Hi @ewhac,
As you know, (nil)
is a valid redis value that does not exists in the Go string type. The (nil)
redis reply returned the redis.ErrNilReply
error value in an older version of gosexy/redis
when a (nil)
reply was received from the redis-server, I think we'd start experimenting with it again.
The fix for issue #12 has itself caused a problem: It is now no longer possible to detect via Get() that a key does not exist.
If you GET a non-existent key in Redis, you get a nil value:
To fix issue #12, nil responses from the server were converted to the Go zero-value for a string, which is "" (empty string). However, "" is a valid value for a Redis key:
As such, keys with empty values are now indistinguishable from keys that do not exist. This is a problem.
It is unclear how to fix this without breaking existing client code. One possibility might be a settable option in the Client struct that says how to deal with nil values from the server, and passed as an argument to setReplyValue()...