migueldeicaza/redis-sharp — pull request #8 by rfranke (2014-08-22 08:51:26+00:00)
Title: Add implementation for pub/sub

This pull request extends RedisSharp with pub/sub, treating Redis messages as C# events.

The extension asks for a restructuring of redis-sharp.cs, because:
- subscriptions must use an exclusive client connection to not mess up with command replies
- the ECMA CLI binding for pub/sub defines delegates and EventArg types, which should be grouped in a namespace

The first question is if not the existing classes `Redis` and `SortOptions` should go into the new namespace `RedisSharp` as well.

The second question arises from the possibility to re-use the existing basic communication functionality for subscribers. The current `Redis` provides the common communication together with Redis commands, which are not allowed for subscribers. The Dispose method calls Redis QUIT, which is neither allowed for subscribers.

This is why I'd like to split redis-sharp.cs into three files, each implementing one respective class:
1. RedisComm.cs implementing the basic communication
2. Redis.cs extending from `RedisComm` and providing regular Redis commands, like Set(string, byte [])
3. RedisSharp.cs extending from `Redis` and adding specific C# bindings, like Set(IDictionary)

The new RedisSub.cs would then extend from `RedisComm`. This makes the regular Redis commands unavailable for subscribers. Moreover the Dispose method of RedisComm would not call QUIT.

What do you think?