Example #1
0
 public void EnsureDerivationCacheConsistent()
 {
     lock (_derivationCache)
     {
         if (_derivationTimeStamp < _frontendServer.Server.DerivationTimeStamp)
         {
             _derivationCache.Clear();
             _derivationTimeStamp = _frontendServer.Server.DerivationTimeStamp;
         }
     }
 }
 /// <summary> Remove all entries from the cache. </summary>
 public void Clear()
 {
     lock (this)
     {
         if (_cache != null)
         {
             _cache.Clear();
         }
     }
 }
Example #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();
                }
            }
        }
Example #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());
        }
Example #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());
        }