public void Add(Link link) { lock (creatorToOther) { creatorToOther.GetOrAdd(link.Creator).Add(link.Other); otherToCreator.GetOrAdd(link.Other).Add(link.Creator); } }
public void Remove(Link link) { lock (creatorToOther) { List<ActorId> a; foreach (var alias in DnsAlias.Get(link.Creator)) if (creatorToOther.TryGetValue(alias, out a)) { a.Remove(alias); if (!a.Any()) creatorToOther.Remove(alias); } foreach(var alias in DnsAlias.Get(link.Other)) if (otherToCreator.TryGetValue(alias, out a)) { a.Remove(alias); if (!a.Any()) otherToCreator.Remove(alias); } } }