Esempio n. 1
0
        /// <summary>
        /// Removes all entries from the store.
        /// </summary>
        internal override void ClearInternal()
        {
            if (_cacheStore == null)
            {
                throw new InvalidOperationException();
            }

            _cacheStore.Clear();

            _topicManager.Clear();

            _context.PerfStatsColl.SetCacheSize(0); // on clear cache cachesize set to zero

            if (_evictionThread != null)
            {
                NCacheLog.Flush();
#if !NETCORE
                _evictionThread.Abort();
#elif NETCORE
                _evictionThread.Interrupt();
#endif
            }

            if (_evictionPolicy != null)
            {
                _evictionPolicy.Clear();

                if (_context.PerfStatsColl != null)
                {
                    _context.PerfStatsColl.SetEvictionIndexSize(_evictionPolicy.IndexInMemorySize);
                }
            }
        }
Esempio n. 2
0
        public void Clearing()
        {
            var topics = new TopicManager();

            Assert.AreEqual(0, topics.GetPeers("alpha").Count());
            Assert.AreEqual(0, topics.GetPeers("beta").Count());

            topics.AddInterest("alpha", a);
            topics.AddInterest("beta", b);
            Assert.AreEqual(1, topics.GetPeers("alpha").Count());
            Assert.AreEqual(1, topics.GetPeers("beta").Count());

            topics.Clear();
            Assert.AreEqual(0, topics.GetPeers("alpha").Count());
            Assert.AreEqual(0, topics.GetPeers("beta").Count());
        }