StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.88k stars 1.51k forks source link

Replace all occurrences of "nil" in `IDatabase(Async)` xmldoc with less ambiguous alternatives #2702

Closed bdach closed 4 months ago

bdach commented 5 months ago

Closes https://github.com/StackExchange/StackExchange.Redis/issues/2697.

All of the replacements were empirically tested to be correct via simple programs in combination with a local redis instance.

Notably, there is one worrying nit; in testing it turns out that the IDatabase.List{Left,Right}Pop(RedisKey, long, CommandFlags) overload which I talked about in the issue can actually return null, contrary to its nullability annotations. This occurs on missing key; in that case redis replies

Nil reply: if the key does not exist.

as per https://redis.io/docs/latest/commands/lpop/, which then at

https://github.com/StackExchange/StackExchange.Redis/blob/cb8b20df0e2975717bde97ce95ac20e8e8353572/src/StackExchange.Redis/ResultProcessor.cs#L1546-L1547

and later at

https://github.com/StackExchange/StackExchange.Redis/blob/cb8b20df0e2975717bde97ce95ac20e8e8353572/src/StackExchange.Redis/ExtensionMethods.cs#L339-L341

turns into a null.

I briefly attempted to rectify this, but the RedisValueArrayProcessor poses a problem here, as changing it to derive ResultProcessor<RedisValue[]?> causes the solution to light up in red, and I'd rather not mess with that as a first contribution without at least prior discussion concerning direction there.