예제 #1
0
파일: Node.cs 프로젝트: mikeblakeuk/MNP
        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));
                        }
                    }
                });
            }
        }