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


C# MemcachedClient.FlushAll方法代码示例

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


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

示例1: GetClient

        protected override MemcachedClient GetClient()
        {
            MemcachedClient client = new MemcachedClient("test/binaryConfig");
            client.FlushAll();

            return client;
        }
开发者ID:sneal,项目名称:EnyimMemcached,代码行数:7,代码来源:BinaryMemcachedClientTest.cs

示例2: Add_Study

        public void Add_Study()
        {
            using (var client = new MemcachedClient())
            {
                var result1 = client.Store(StoreMode.Add, "userid", "123456");
                Assert.True(result1);

                // 不可以多次调用
                var result2 = client.Store(StoreMode.Add, "userid", "123456");
                Assert.False(result2);

                client.FlushAll();
            }
        }
开发者ID:happyframework,项目名称:Study.Memcached,代码行数:14,代码来源:MemcachedClientStudy.cs

示例3: Get_Study

        public void Get_Study()
        {
            using (var client = new MemcachedClient())
            {
                // 没有键,返回null。
                var result1 = client.Get("userid");
                Assert.Null(result1);

                client.Store(StoreMode.Set, "userid", "123456");
                var result2 = client.Get("userid");
                Assert.AreEqual("123456", result2);

                client.FlushAll();
            }
        }
开发者ID:happyframework,项目名称:Study.Memcached,代码行数:15,代码来源:MemcachedClientStudy.cs

示例4: Replace_Study

        public void Replace_Study()
        {
            using (var client = new MemcachedClient())
            {
                // 没有键,不能替换。
                var result1 = client.Store(StoreMode.Replace, "userid", "123456");
                Assert.False(result1);

                // 有的话,就可以。
                client.Store(StoreMode.Add, "userid", "123456");
                var result2 = client.Store(StoreMode.Replace, "userid", "123456");
                Assert.True(result2);

                client.FlushAll();
            }
        }
开发者ID:happyframework,项目名称:Study.Memcached,代码行数:16,代码来源:MemcachedClientStudy.cs

示例5: FlushCache

 /// <summary>
 /// 清空缓存
 /// </summary>
 public static void FlushCache()
 {
     using (MemcachedClient mc = new MemcachedClient())
     {
         mc.FlushAll();
     }
 }
开发者ID:cityjoy,项目名称:CommonToolkit,代码行数:10,代码来源:EnyimMemcacheHelper).cs

示例6: FlushTest

		public void FlushTest()
		{
			MemcachedClient mc = new MemcachedClient();
			mc.Store(StoreMode.Set, "qwer", "1");
			mc.Store(StoreMode.Set, "tyui", "1");
			mc.Store(StoreMode.Set, "polk", "1");
			mc.Store(StoreMode.Set, "mnbv", "1");
			mc.Store(StoreMode.Set, "zxcv", "1");
			mc.Store(StoreMode.Set, "gfsd", "1");

			Assert.AreEqual("1", mc.Get("mnbv"), "Setup for FlushAll() failed");

			mc.FlushAll();

			Assert.IsNull(mc.Get("qwer"), "FlushAll() failed.");
			Assert.IsNull(mc.Get("tyui"), "FlushAll() failed.");
			Assert.IsNull(mc.Get("polk"), "FlushAll() failed.");
			Assert.IsNull(mc.Get("mnbv"), "FlushAll() failed.");
			Assert.IsNull(mc.Get("zxcv"), "FlushAll() failed.");
			Assert.IsNull(mc.Get("gfsd"), "FlushAll() failed.");
		}
开发者ID:xxjeng,项目名称:nuxleus,代码行数:21,代码来源:MemcachedClientTest.cs

示例7: Delete_Study

        public void Delete_Study()
        {
            using (var client = new MemcachedClient())
            {
                // 没有键,返回false。
                var result1 = client.Remove("userid");
                Assert.False(result1);

                client.Store(StoreMode.Set, "userid", "123456");
                var result2 = client.Remove("userid");
                Assert.True(result2);

                client.FlushAll();
            }
        }
开发者ID:happyframework,项目名称:Study.Memcached,代码行数:15,代码来源:MemcachedClientStudy.cs

示例8: Cas_Study

        public void Cas_Study()
        {
            using (var client = new MemcachedClient())
            {
                /* 
                 * 非常重要的CAS操作 
                 */

                client.Store(StoreMode.Set, "userid", "123456");
                var result1 = client.GetWithCas("userid");
                var result2 = client.Cas(StoreMode.Set, "userid", "6543321");
                Assert.True(result2.Result);
                var result3 = client.Cas(StoreMode.Set, "userid", "123456", result1.Cas);
                Assert.False(result3.Result);

                client.FlushAll();
            }
        }
开发者ID:happyframework,项目名称:Study.Memcached,代码行数:18,代码来源:MemcachedClientStudy.cs

示例9: Gets_Study

        public void Gets_Study()
        {
            using (var client = new MemcachedClient())
            {
                /* 
                 * 非常重要的CAS操作 
                 */

                client.Store(StoreMode.Set, "userid", "123456");
                var result = client.GetWithCas("userid");

                Assert.AreEqual("123456", result.Result);
                Assert.Greater(result.Cas, 0u);

                client.FlushAll();
            }
        }
开发者ID:happyframework,项目名称:Study.Memcached,代码行数:17,代码来源:MemcachedClientStudy.cs


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