コード例 #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();
            }
        }
コード例 #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();
             }
         }
     }
 }
コード例 #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);
         }
     }
 }
コード例 #4
0
 public RedisBatch(RedisConnectionPool pool, int dbIndex, bool throwOnError = true)
     : base(pool, dbIndex, throwOnError)
 {
 }
コード例 #5
0
 public RedisPoolClient(RedisConnectionPool pool, bool throwOnError = true)
     : base(throwOnError)
 {
     m_Pool = pool;
 }
コード例 #6
0
ファイル: RedisDb.cs プロジェクト: ocdogan/Sweet.Redis
 public RedisDb(RedisConnectionPool pool, int dbIndex, bool throwOnError = true)
     : base(pool, throwOnError)
 {
     m_DbIndex = Math.Min(Math.Max(dbIndex, RedisConstants.UninitializedDbIndex), RedisConstants.MaxDbIndex);
 }