当前位置: 首页>>代码示例>>C#>>正文


C# Cache.Remove方法代码示例

本文整理汇总了C#中Cache.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Cache.Remove方法的具体用法?C# Cache.Remove怎么用?C# Cache.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cache的用法示例。


在下文中一共展示了Cache.Remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanRemove

        public void CanRemove()
        {
            var cache = new Cache<string, string>();
            cache["Foo"] = "Bar";

            cache.Remove("Foo").ShouldBe(true);
            cache.ContainsKey("Foo").ShouldBe(false);
        }
开发者ID:RyanHauert,项目名称:presentations-immutability,代码行数:8,代码来源:CacheTests.cs

示例2: Insert

 public  void Insert(string key, object obj, double Minutes)
 {
     Cache cache = new Cache();
     if (obj != null)
     {
         this.Response.Write(cache);
         cache.Remove("dd");
         cache.Insert(key, obj, null, DateTime.Now.AddMinutes(Minutes), Cache.NoSlidingExpiration, CacheItemPriority.High, (a,b,c) => { });
     }
     
 }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:11,代码来源:Default.aspx.cs

示例3: Cache_Remove_Item_Key_Should_Remove_Item

 public void Cache_Remove_Item_Key_Should_Remove_Item()
 {
     Cache<string, int> cache = new Cache<string, int>();
     bool EXPECTED = true;
     cache.Add("1", 1);
     Assert.AreEqual(EXPECTED, cache.Remove("1"));
     int EXPECTEDCOUNT = 0;
     Assert.AreEqual(EXPECTEDCOUNT, cache.Count);
     EXPECTED = false;
     Assert.AreEqual(EXPECTED, cache.Contains("1"));
 }
开发者ID:rahilkidwai,项目名称:Net.Utility,代码行数:11,代码来源:CacheTests.cs

示例4: TestCache

 /// <exception cref="System.Exception"></exception>
 public virtual void TestCache()
 {
     int retainCount = 1;
     Cache cache = new Cache<string, Document>(retainCount);
     IDictionary<string, object> props = new Dictionary<string, object>();
     props.Put("foo", "bar");
     Document doc1 = CreateDocumentWithProperties(database, props);
     cache.Put(doc1.GetId(), doc1);
     IDictionary<string, object> props2 = new Dictionary<string, object>();
     props2.Put("foo2", "bar2");
     Document doc2 = CreateDocumentWithProperties(database, props2);
     cache.Put(doc2.GetId(), doc2);
     NUnit.Framework.Assert.IsNotNull(cache.Get(doc1.GetId()));
     NUnit.Framework.Assert.IsNotNull(cache.Get(doc2.GetId()));
     cache.Remove(doc1.GetId());
     NUnit.Framework.Assert.IsNull(cache.Get(doc1.GetId()));
     cache.Clear();
     NUnit.Framework.Assert.IsNull(cache.Get(doc2.GetId()));
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:20,代码来源:CacheTest.cs

示例5: ClearCache

 private void ClearCache()
 {
     // clear the cache store. 
     Cache<X509Certificate2Collection> cache = new Cache<X509Certificate2Collection>(TestCacheName);             
     foreach (string domain in m_domains)
     {
         cache.Remove(domain);                
     }
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:9,代码来源:CertificateResolverFacts.cs

示例6: Remove_ShouldDoNothingIfAbsent_Test

 public void Remove_ShouldDoNothingIfAbsent_Test()
 {
     Cache cache = new Cache();
     cache.Remove(TestKey);
     Assert.IsNull(cache.Get<string, string>(TestKey));
 }
开发者ID:RejectKid,项目名称:RiotSharp,代码行数:6,代码来源:CacheTest.cs

示例7: Remove_ShouldDoNothingIfNull_Test

        public void Remove_ShouldDoNothingIfNull_Test()
        {
            Cache cache = new Cache();
            cache.Add(TestKey, TestValue, new TimeSpan(0, 0, 1));

            Assert.AreEqual(TestValue, cache.Get<string, string>(TestKey));
            cache.Remove<string>(null);
            Assert.AreEqual(TestValue, cache.Get<string, string>(TestKey));
        }
开发者ID:RejectKid,项目名称:RiotSharp,代码行数:9,代码来源:CacheTest.cs

示例8: Remove_ShouldRemoveIfPresent_Test

        public void Remove_ShouldRemoveIfPresent_Test()
        {
            Cache cache = new Cache();
            cache.Add(TestKey, TestValue, new TimeSpan(0, 0, 1));

            Assert.AreEqual(TestValue, cache.Get<string, string>(TestKey));
            cache.Remove(TestKey);
            Assert.IsNull(cache.Get<string, string>(TestKey));
        }
开发者ID:RejectKid,项目名称:RiotSharp,代码行数:9,代码来源:CacheTest.cs


注:本文中的Cache.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。