//add this server to cache. public void AddToCache(Server serverObject) { string ID = serverObject.ServerId; ServersListId.Add(ID); ServersDictionary.Add(ID, serverObject); }
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); } } }