private static ApiCache GetCache(System.Web.Caching.Cache cache) { try { ApiCache dataObject = (ApiCache)cache["ApiCache"]; if (dataObject == null) { dataObject = (ApiCache)cache["ApiCache"]; if (dataObject == null) { dataObject = new ApiCache(); TeamFactory lo = new TeamFactory(); dataObject.Countries = new List<CountryClass>(); TeamDisplay team = new TeamDisplay(); var logos = lo.GetAllLogos(team); foreach (var l in logos) l.SaveLocation = null; dataObject.Logos = logos; var scoreboardLogos = team.ScoreboardLogos; foreach (var l in scoreboardLogos) l.SaveLocation = null; dataObject.ScoreboardLogos = scoreboardLogos; cache["ApiCache"] = dataObject; } } return dataObject; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }
private static ApiCache UpdateCache(ApiCache siteCache) { try { lock (ThisLock) { HttpContext.Current.Cache["ApiCache"] = siteCache; } return siteCache; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }