本文整理汇总了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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例5: FlushCache
/// <summary>
/// 清空缓存
/// </summary>
public static void FlushCache()
{
using (MemcachedClient mc = new MemcachedClient())
{
mc.FlushAll();
}
}
示例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.");
}
示例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();
}
}
示例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();
}
}
示例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();
}
}