nrk / redis-lua

A Lua client library for the redis key value storage system.
MIT License
731 stars 239 forks source link

Return value of EXISTS is inconsistent with core redis #54

Open aeisenberg opened 6 years ago

aeisenberg commented 6 years ago

This library, will return true or false for all calls to EXISTS. However, this is not consistent with the return value for core redis. According to the documentation:

Return value

Integer reply, specifically:

  • 1 if the key exists.
  • 0 if the key does not exist.

Since Redis 3.0.3 the command accepts a variable number of keys and the return value is generalized:

  • The number of keys existing among the ones specified as arguments. Keys mentioned multiple times and existing are counted multiple times.

When passing multiple keys, there is no way to determine how many of the keys exist.

aeisenberg commented 6 years ago

And, looks like the same problem for HEXISTS.

aeisenberg commented 6 years ago

Even though, SISMEMBER returns a boolean in this library, but an integer in core redis, I don't think the issue is particularly important since SISMEMBER only takes a single value as an argument, the return values are only 1 or 0. So, no data is lost.