Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle non-existent keys properly in Store.SMembers (#111)
I saw some unexpected traces when debugging some custom instrumentation I'm adding. Basically, the service was not looking for claims in IPNI or legacy systems even though there were no results in the cache. Turns out that the `SMEMBERS` command doesn't return `(nil)` when the key doesn't exist, as others commands do. Instead, it returns an empty set (see the docs for [SMEMBERS](https://redis.io/docs/latest/commands/smembers/#:~:text=This%20has%20the%20same%20effect%20as%20running%20SINTER%20with%20one%20argument%20key.) and then [SINTER](https://redis.io/docs/latest/commands/sinter/#:~:text=Keys%20that%20do%20not%20exist%20are%20considered%20to%20be%20empty%20sets.)). Therefore, the store was returning an empty slice instead of `ErrKeyNotFound`. I added an explicit existence check in `SMembers` when the command returns an empty set, assuming that it may be interesting to differentiate between a non-existent and an empty set.
- Loading branch information