本文整理汇总了C#中RedisClient.del方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.del方法的具体用法?C# RedisClient.del怎么用?C# RedisClient.del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedisClient
的用法示例。
在下文中一共展示了RedisClient.del方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteResult
public void DeleteResult()
{
using (dynamic client = new RedisClient())
{
client.set("delete", "some val"); // give it a value initially
bool first = client.del("delete"); // was deleted: true
bool second = client.del("delete"); // no longer existed: false
Assert.IsTrue(first);
Assert.IsFalse(second);
}
}
示例2: GetSet
public void GetSet()
{
using (dynamic client = new RedisClient())
{
client.del("getset"); // wipe
client.set("getset", "def"); // assign
string val = client.get("getset"); // fetch
Assert.AreEqual("def", val);
}
}
示例3: Counters
public void Counters()
{
using (dynamic client = new RedisClient())
{
client.del("counter"); // note: missing counts as 0
int a = client.incr("counter"); // 0+1: should be 1
int b = client.incrby("counter", 5); // 1+5, should be 6
int c = client.decr("counter"); // 6-1: should be 5
Assert.AreEqual(1, a, "a");
Assert.AreEqual(6, b, "b");
Assert.AreEqual(5, c, "c");
}
}
示例4: Lists
public void Lists()
{
using (dynamic client = new RedisClient())
{
client.del("list");
client.rpush("list", "item 1");
client.rpush("list", "item 2");
string a = client.lpop("list");
string b = client.lpop("list");
string c = client.lpop("list");
client.rpush("list", "item 3");
string d = client.lpop("list");
Assert.AreEqual(a, "item 1");
Assert.AreEqual(b, "item 2");
Assert.IsNull(c);
Assert.AreEqual(d, "item 3");
}
}