PubSubBase.cs 496 B

12345678910111213141516171819202122
  1. using StackExchange.Redis;
  2. using System;
  3. namespace VCommon.PubSub
  4. {
  5. public class PubSubBase : IDisposable
  6. {
  7. protected readonly string ChannelName;
  8. internal readonly ConnectionMultiplexer Conn;
  9. public PubSubBase(string server, string channelName)
  10. {
  11. ChannelName = channelName;
  12. Conn = ConnectionMultiplexer.Connect(server);
  13. }
  14. public virtual void Dispose()
  15. {
  16. Conn?.Dispose();
  17. }
  18. }
  19. }