Esempio n. 1
0
        public void Run()
        {
            var tester = new CacheStressTester <object, object>(rng);

            RunTime = tester.TestCache(
                cache,
                generateKey,
                generateValue,
                false,
                true);
        }
Esempio n. 2
0
        public void WeakCacheCleanup2()
        {
            int iterations = 100;
            var cache      = new WeakCache <object, object>();

            for (int i = 0; i < iterations; i++)
            {
                var stressTester = new CacheStressTester <object, object>(
                    rng,
                    CacheStressTester <object, object> .DefaultOpCount / iterations);
                stressTester.TestCache(
                    cache,
                    GenerateInt32Object,
                    GenerateInt32Object,
                    true,
                    false);
                stressTester = null;
                GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
                cache.Cleanup();
            }
        }