feat: add RedisConnection interface and allow database to create conn…#1
feat: add RedisConnection interface and allow database to create conn…#1rishtigupta wants to merge 1 commit intomainfrom
Conversation
| /// <summary> | ||
| /// Represents a Redis connection interface. | ||
| /// </summary> | ||
| public interface IRedisConnection |
There was a problem hiding this comment.
The RedisConnection class implements this interface
| { | ||
| if (nullToEmpty) | ||
| return []; | ||
| return new T[0]; |
There was a problem hiding this comment.
The code was not compiling since it gave errors on returning an empty array like so.
So, I google searched and found this solution of returning an empty array
| /// <param name="converter">Optional value converter.</param> | ||
| /// <param name="handler">Connection event handler.</param> | ||
| /// <param name="logger">Logger.</param> | ||
| public RedisConnection(IDatabaseAsync database, IValueConverter? converter = null, IConnectionEventHandler? handler = null, TextWriter? logger = null) |
There was a problem hiding this comment.
ah okay so this is the main change in this PR then? Allowing the database to be passed in to the constructor. That makes sense.
In the code samples where you saw CloudStructures being used (both the customer one and the hello world one), I thought I saw some interactions with this class through static methods (meaning that the caller wouldn't necessarily have even called the constructor first). Is that accurate or am I misremembering?
There was a problem hiding this comment.
The hello world example, I have been calling the constructor to make a connection while in the customer code, they were directly using the "GetConnection" call from the RedisConnection class. But due to lack of full code, I couldn't determine if they were making a call to the same GetConnection as present in this RedisConnection class.
…ection
PR Description: