public override void Remove(IDatabaseAsync context, IEnumerable <TValue> items) { foreach (var item in items) { context.SetRemoveAsync(GenerateSetName(IndexedKeyExtractor.ExtractKey(item)), IndexedValueExtractor(item)); } }
public override void AddOrUpdate( IDatabaseAsync context, TValue newItem, TValue oldItem) { if (oldItem != null && !IndexedKeyExtractor.ExtractKey(newItem) .Equals(IndexedKeyExtractor.ExtractKey(oldItem), StringComparison.OrdinalIgnoreCase)) { Remove(context, new[] { oldItem }); } Set(context, new[] { newItem }); }
public override void AddOrUpdate(IDatabaseAsync context, TValue newItem, TValue oldItem) { var oldKey = oldItem != null?IndexedKeyExtractor.ExtractKey(oldItem) : null; var newKey = newItem != null?IndexedKeyExtractor.ExtractKey(newItem) : null; if (oldKey != null && !oldKey.Equals(newKey, StringComparison.OrdinalIgnoreCase)) { Remove(context, new[] { oldItem }); } if (newKey != null) { Set(context, new[] { newItem }); } }