コード例 #1
0
 public void EnsureDerivationCacheConsistent()
 {
     lock (_derivationCache)
     {
         if (_derivationTimeStamp < _frontendServer.Server.DerivationTimeStamp)
         {
             _derivationCache.Clear();
             _derivationTimeStamp = _frontendServer.Server.DerivationTimeStamp;
         }
     }
 }
コード例 #2
0
 /// <summary> Remove all entries from the cache. </summary>
 public void Clear()
 {
     lock (this)
     {
         if (_cache != null)
         {
             _cache.Clear();
         }
     }
 }
コード例 #3
0
        /// <summary>Clears the plan cache, disposing any plans it contains.</summary>
        public void Clear(ServerProcess process)
        {
            lock (this)
            {
                if (_plans != null)
                {
                    foreach (CachedPlans tempValue in (IEnumerable <CachedPlans>)_plans)
                    {
                        DisposeCachedPlans(process, tempValue);
                    }

                    _plans.Clear();
                }
            }
        }
コード例 #4
0
        public void ClearAndCount()
        {
            int LCacheSize = 5;

            FTestCache = new FixedSizeCache <string, string>(LCacheSize);
            for (int i = 1; i <= FTestCache.Size; i++)
            {
                FTestCache.Add(GetKey(i), GetValue(i));
                Assert.AreEqual(i, FTestCache.Count);
            }
            Assert.AreEqual(LCacheSize, FTestCache.Count);

            FTestCache.Clear();
            Assert.AreEqual(0, FTestCache.Count);
            Assert.True(ValidateList());
        }
コード例 #5
0
        public void ContainsKey()
        {
            int LCacheSize     = 5;
            int LTestCacheItem = 3;

            FTestCache = new FixedSizeCache <string, string>(LCacheSize);

            Assert.False(FTestCache.ContainsKey(GetKey(LTestCacheItem)));

            for (int i = 1; i <= FTestCache.Size; i++)
            {
                FTestCache.Add(GetKey(i), GetValue(i));
            }

            Assert.True(FTestCache.ContainsKey(GetKey(LTestCacheItem)));

            FTestCache.Clear();
            Assert.False(FTestCache.ContainsKey(GetKey(LTestCacheItem)));
            Assert.True(ValidateList());
        }