Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubSub2 #9

Closed
wants to merge 3 commits into from
Closed

PubSub2 #9

wants to merge 3 commits into from

Conversation

rfranke
Copy link
Contributor

@rfranke rfranke commented Aug 26, 2014

Here is another pull request for the pub/sub implementation. The new RedisSub extends from Redis and adds (p)(un)subscribe methods. Received messages are treated as C# events.

A new ReadMixedArray method has been added to receive arrays with elements of mixed data types and nested arrays -- subscribe messages contain an integer element. The new Redis Scan method has been added as a second use case for such mixed arrays (and because it is an important alternative to the KEYS command for large databases).

Note that Redis subscribers must not send regular Redis commands, in order to not mess up command replies with messages. This is also why the QUIT command has been commented out in Redis.Dispose(). One might consider to split the existing Redis class into a basic RedisClient that just treats the connection and the communication protocol -- comparable to the redis-cli program -- and a second Redis class that extends from RedisClient and provides all the C# methods for specific commands. RedisSub could then extend from the RedisClient as well and would not inherit commands that should not be used by subscribers. Redis.Dispose() could then call QUIT, while RedisClient.Dispose() would close the socket.

- new file RedisSub.cs implementing a subscriber an emitting events
- add Publish command to regular Redis class
- change protection level of Send/Read methods to allow derived classes
- new ReadMixedArray for arrays with mixed element types
- extend ReadData with an optional look-ahead token
- separate ReadInt from SendExpectInt and SendDataExpectInt
- disable call to QUIT in Redis.Dispose because derived RedisSub must not call it
- move DEBUG from redis-sharp.cs to Makefile to make Log working in RedisSub
- extended test.cs to cover pub/sub
…destination, key),

to make clear that the return type differs, see also Redis S*STORE commands.
@rfranke
Copy link
Contributor Author

rfranke commented Aug 30, 2014

First let's become clear if redis-sharp shall be further developed at all. See also #10.

@rfranke rfranke closed this Aug 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant