示例#1
0
        public void GetWithMetadataImmortalTest()
        {
            String key = UniqueKey.NextKey();

            /* Created immortal entry. */
            cache.Put(key, "uranium");
            IMetadataValue <String> metadata = cache.GetWithMetadata(key);

            Assert.AreEqual("uranium", metadata.GetValue());

            Assert.IsTrue(metadata.GetLifespan() < 0);
            Assert.AreEqual(-1, metadata.GetCreated());

            Assert.IsTrue(metadata.GetMaxIdle() < 0);
            Assert.AreEqual(-1, metadata.GetLastUsed());
        }
示例#2
0
        public void GetWithMetadataTest()
        {
            String key = UniqueKey.NextKey();

            /* Created with lifespan/maxidle. */
            cache.Put(key, "rubidium", 60, TimeUnit.MINUTES, 30, TimeUnit.MINUTES);

            IMetadataValue <String> metadata = cache.GetWithMetadata(key);

            Assert.AreEqual("rubidium", metadata.GetValue());

            Assert.AreEqual(3600, metadata.GetLifespan());
            Assert.AreNotEqual(0, metadata.GetCreated());

            Assert.AreEqual(1800, metadata.GetMaxIdle());
            Assert.AreNotEqual(0, metadata.GetLastUsed());
        }