예제 #1
0
        //add this server to cache.
        public void AddToCache(Server serverObject)
        {
            string ID = serverObject.ServerId;

            ServersListId.Add(ID);
            ServersDictionary.Add(ID, serverObject);
        }
예제 #2
0
        public void deleteServerById(IMemoryCache cache, string Id)
        {
            Dictionary <string, Server> ServersDictionary;

            //delete this server from the list.
            if (cache.TryGetValue("ServersDictionary", out ServersDictionary))
            {
                Server serverObject;
                if (ServersDictionary.TryGetValue(Id, out serverObject))
                {
                    ServersDictionary.Remove(Id);
                }
            }
        }