本文整理汇总了C#中IDatabase.SetRemove方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.SetRemove方法的具体用法?C# IDatabase.SetRemove怎么用?C# IDatabase.SetRemove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabase
的用法示例。
在下文中一共展示了IDatabase.SetRemove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompleteTask
public static void CompleteTask(IDatabase db, string task)
{
db.SetRemove("running", task);
db.HashSet("task-" + task, new[] { new HashEntry("complete", DateTime.Now.ToString("dd/MM/yy HH:mm:ss.fff")) });
db.SetAdd("complete", task);
var workflow = db.HashGet("task-" + task, "workflow");
var remaining = db.HashDecrement("workflow-" + workflow, "tasksRemaining");
if (remaining.Equals(0))
{
db.Publish("workflowComplete", workflow);
return;
}
var children = db.SetMembers("children-" + task);
foreach (var child in children)
{
db.SetRemove("parents-" + child, task);
if (db.SetLength("parents-" + child).Equals(0))
{
Direct.PushTask(db, child);
}
}
Console.WriteLine("completed: " + task);
}
示例2: InvalidateItem
public void InvalidateItem(string key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
_database = _redis.GetDatabase();
key = HashKey(key);
lock (_lock)
{
try
{
var entry = _database.Get<CacheEntry>(key);
if (entry == null) return;
_database.KeyDelete(key);
foreach (var set in entry.EntitySets) {
_database.SetRemove(GetEntitySetKey(set), key);
}
}
catch (Exception e)
{
OnCachingFailed(e);
}
}
}
示例3: InvalidateItem
public void InvalidateItem(string key)
{
key.GuardAgainstNullOrEmpty(nameof(key));
_database = _redis.GetDatabase();
key = HashKey(key);
lock (_lock)
{
try
{
var entry = _database.Get<CacheEntry>(key);
if (entry == null) return;
_database.KeyDelete(key, CommandFlags.FireAndForget);
foreach (var set in entry.EntitySets) {
_database.SetRemove(AddCacheQualifier(set), key, CommandFlags.FireAndForget);
}
}
catch (Exception e)
{
OnCachingFailed(e);
}
}
}