private void RemoveFromCache(bool localOnly, string id) { if (String.IsNullOrEmpty(id)) { throw new ArgumentException("The key cannot be null or empty", "id"); } ResultCache.Remove(id, localOnly); if (!localOnly) { Task.Run(() => { InterNodeCommunicationMessage msg = new InterNodeCommunicationMessage { Tag = id, IsLocalOnly = true, MessageType = InterNodeMessageType.RemoveFromCache }; // not sure this is valid as its non deterministic lock (KnownNodes) { foreach (var el in KnownNodes) { SendToNode(el, InterNodeCommunicationMessageSerialiser.Serialise(msg)); } } }); } }