public async Task dashBoardCache() { try { var dashboarList = await RequestAPI.getAsyncAllDashboards(dashBoards); foreach (var dashboardLazy in dashboarList) { if (dashboardLazy.disableShow != null) { dashboardLazy.disableShow = dashboardLazy.disableShow.ToLower(); } if (dashboardLazy.disableShow == "false" || dashboardLazy.disableShow == null) { var Dashboard = await RequestAPI.getAsyncDashboard(dashBoards + "/" + dashboardLazy.dashboardConfigId); lock (MemoryCaches.memDash) { if (MemoryCaches.memDash.Where(x => x.dashboardId == Dashboard.dashboardConfigId.ToString()).Count() == 0) { MemoryCaches.memDash.Add(new dashMemory { active = true, dashboardId = Dashboard.dashboardConfigId.ToString(), dashboard = Dashboard }); } else { var cacheItem = MemoryCaches.memDash.Where(x => x.dashboardId == Dashboard.dashboardConfigId.ToString()).FirstOrDefault(); var index = MemoryCaches.memDash.IndexOf(cacheItem); MemoryCaches.memDash[index] = new dashMemory { active = cacheItem.active, dashboardId = Dashboard.dashboardConfigId.ToString(), dashboard = Dashboard }; } } } else { RequestAPI.DelAsyncCache(cacheURlMain + "/" + dashboardLazy.dashboardConfigId); } } Logger.Info("------------------Dashboard Cache Updated------------------"); } catch (Exception ex) { Logger.Error(ex.ToString()); } }