Beispiel #1
0
        public void NearCacheListenNoneAggregateTest()
        {
            LocalNamedCache localcache = new LocalNamedCache();
            INamedCache     safecache  = CacheFactory.GetCache(CacheName);
            NearCache       nearcache  = new NearCache(localcache, safecache, CompositeCacheStrategyType.ListenNone);

            nearcache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("Aleks", 1);
            ht.Add("Ana", 2);
            ht.Add("Goran", 3);
            ht.Add("Ivan", 4);
            nearcache.InsertAll(ht);

            IEntryAggregator aggregator = new Count();
            object           count      = nearcache.Aggregate(nearcache.Keys, aggregator);

            Assert.AreEqual(ht.Count, count);

            IFilter filter = new LessFilter(IdentityExtractor.Instance, 3);

            count = nearcache.Aggregate(filter, aggregator);
            Assert.AreEqual(2, count);

            nearcache.Clear();
            nearcache.Release();
            Assert.IsFalse(nearcache.IsActive);

            CacheFactory.Shutdown();
        }