Ejemplo n.º 1
0
        protected override void OnDispose(bool disposing)
        {
            Interlocked.Exchange(ref MonitorCompleted, null);
            Interlocked.Exchange(ref PubSubCompleted, null);
            Interlocked.Exchange(ref PubSubPulseStateChanged, null);
            Interlocked.Exchange(ref PoolPulseStateChanged, null);

            if (m_ProbeAttached)
            {
                RedisCardio.Default.Detach(this);
            }

            RedisConnectionPool.Unregister(this);
            CloseMemberStore();

            base.OnDispose(disposing);

            StopToProcessQ();

            var monitorChannel = Interlocked.Exchange(ref m_MonitorChannel, null);

            if (monitorChannel != null)
            {
                monitorChannel.Dispose();
            }

            var pubSubChannel = Interlocked.Exchange(ref m_PubSubChannel, null);

            if (pubSubChannel != null)
            {
                pubSubChannel.Dispose();
            }
        }
Ejemplo n.º 2
0
 private static void Unregister(RedisConnectionPool pool)
 {
     lock (s_PoolLock)
     {
         s_Pools.Remove(pool);
         if (s_Pools.Count == 0)
         {
             var timer = Interlocked.Exchange(ref s_PurgeTimer, null);
             if (timer != null)
             {
                 timer.Dispose();
             }
         }
     }
 }
Ejemplo n.º 3
0
 private static void Register(RedisConnectionPool pool)
 {
     lock (s_PoolLock)
     {
         s_Pools.Add(pool);
         if (s_PurgeTimer == null)
         {
             s_PurgeTimer = new Timer((state) =>
             {
                 var pools = GetPoolList();
                 if (!pools.IsEmpty())
                 {
                     pools.AsParallel().ForAll(p => p.PurgeIdles());
                 }
             }, null,
                                      RedisConstants.ConnectionPurgePeriod,
                                      RedisConstants.ConnectionPurgePeriod);
         }
     }
 }
Ejemplo n.º 4
0
 public RedisBatch(RedisConnectionPool pool, int dbIndex, bool throwOnError = true)
     : base(pool, dbIndex, throwOnError)
 {
 }
Ejemplo n.º 5
0
 public RedisPoolClient(RedisConnectionPool pool, bool throwOnError = true)
     : base(throwOnError)
 {
     m_Pool = pool;
 }
Ejemplo n.º 6
0
 public RedisDb(RedisConnectionPool pool, int dbIndex, bool throwOnError = true)
     : base(pool, throwOnError)
 {
     m_DbIndex = Math.Min(Math.Max(dbIndex, RedisConstants.UninitializedDbIndex), RedisConstants.MaxDbIndex);
 }