public void TestInsertWithMillis()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml");

            ccf.Config = config;

            INamedCache cache = CacheFactory.GetCache("local-default");

            Assert.IsTrue(cache is LocalNamedCache);

            LocalNamedCache localNamedCache = cache as LocalNamedCache;

            Assert.IsNotNull(localNamedCache);
            localNamedCache.Insert("key1", new LocalCache.Entry(localNamedCache.LocalCache, "key1", "value1"), 300);

            Assert.IsNotNull(localNamedCache["key1"]);

            lock (this)
            {
                Monitor.Wait(this, 400);
            }

            Assert.IsNull(localNamedCache["key1"]);

            CacheFactory.Shutdown();
        }
        public void TestExpiry()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml");

            ccf.Config = config;

            INamedCache cache = CacheFactory.GetCache("local-with-init");

            cache.Clear();
            Hashtable ht = new Hashtable();

            ht.Add("key1", 100.0);
            ht.Add("key2", 80.5);
            ht.Add("key3", 19.5);
            ht.Add("key4", 2.0);

            cache.InsertAll(ht);
            lock (this)
            {
                Monitor.Wait(this, 50);
            }

            foreach (ICacheEntry entry in cache)
            {
                Assert.IsTrue(entry is LocalCache.Entry);
                Assert.IsTrue(((LocalCache.Entry)entry).IsExpired);
            }


            cache = CacheFactory.GetCache("local-custom-impl-with-init");

            cache.Clear();
            ht = new Hashtable();
            ht.Add("key1", 100.0);
            ht.Add("key2", 80.5);
            ht.Add("key3", 19.5);
            ht.Add("key4", 2.0);

            cache.InsertAll(ht);
            lock (this)
            {
                Monitor.Wait(this, 50);
            }

            foreach (ICacheEntry entry in cache)
            {
                Assert.IsTrue(entry is LocalCache.Entry);
                Assert.IsFalse(((LocalCache.Entry)entry).IsExpired);
            }

            LocalNamedCache localCache = new LocalNamedCache();

            localCache.LocalCache.ExpiryDelay = 50;

            localCache.Clear();

            localCache.Insert("key1", 100.0, 2100);
            localCache.Insert("key2", 801.5, 2100);
            localCache.Insert("key3", 40.1, 2100);

            lock (this)
            {
                Monitor.Wait(this, 2300);
            }

            foreach (ICacheEntry entry in localCache)
            {
                Assert.IsTrue(entry is LocalCache.Entry);
                Assert.IsTrue(((LocalCache.Entry)entry).IsExpired);
            }

            CacheFactory.Shutdown();
        }