private static SiteCache UpdateCache(SiteCache siteCache) { try { lock (ThisLock) { HttpContext.Current.Cache["SiteCache"] = siteCache; } return siteCache; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }
private static SiteCache GetCache(System.Web.Caching.Cache cache) { try { SiteCache dataObject = (SiteCache)cache["SiteCache"]; if (dataObject == null) { lock (ThisLock) { dataObject = (SiteCache)cache["SiteCache"]; if (dataObject == null) { dataObject = new SiteCache(); dataObject.LeagueMemberClasses = LeagueMemberClass.GetAllMemberClasses(); if (SiteSingleton.Instance.IsProduction) { //dataObject.PublicMembers = Classes.Account.User.GetAllPublicMembers(); //dataObject.PublicLeagues = Classes.League.League.GetAllPublicLeagues(); //dataObject.NumberOfLeaguesSignedUpWithRDNation = dataObject.PublicLeagues.Count; //dataObject.NumberOfMembersSignedUpWithRDNation = dataObject.PublicMembers.Count; StoreGateway sg = new StoreGateway(); dataObject.ShopItems = sg.GetAllPublishedStoreItems(); dataObject.NumberOfItems = sg.GetAllPublishedStoreItemsCount(); dataObject.CurrentTournaments = Classes.Game.Tournament.GetCurrentTournaments(); } else { //dataObject.PublicMembers = new List<SkaterJson>(); //dataObject.PublicLeagues = new List<LeagueJsonDataTable>(); dataObject.ShopItems = new DisplayStore(); //dataObject.PublicMembers = Classes.Account.User.GetAllPublicMembers(); //dataObject.PublicLeagues = Classes.League.League.GetAllPublicLeagues(); //dataObject.NumberOfLeaguesSignedUpWithRDNation = dataObject.PublicLeagues.Count; //dataObject.NumberOfMembersSignedUpWithRDNation = dataObject.PublicMembers.Count; StoreGateway sg = new StoreGateway(); dataObject.ShopItems = sg.GetAllPublishedStoreItems(); //dataObject.StoreItems = sg.SearchStoreItems(); //dataObject.NumberOfItems = sg.GetAllPublishedStoreItemsCount(); //dataObject.NumberOfLeaguesSignedUpWithRDNation = 0; //dataObject.NumberOfMembersSignedUpWithRDNation = 0; dataObject.CurrentTournaments = new List<Tournament>(); } dataObject.MemberIdsForUserNames = new List<MemberDisplayBasic>(); dataObject.CurrencyExchangeRates = new List<CurrencyExchange>(); dataObject.PastGames = new List<CurrentGameJson>(); dataObject.NumberOfFederationsSignedUpWithRDNation = Classes.Federation.Federation.GetNumberOfFederations(); dataObject.Countries = Classes.Location.LocationFactory.GetCountries(); dataObject.PublicMemberFullProfile = new List<MemberDisplay>(); dataObject.LeaguePages = new List<RDN.Portable.Classes.League.Classes.League>(); //dataObject.CalendarEvents = new List<CalendarEvent>(); dataObject.CalendarEventsModel = new EventsOutModel(); dataObject.CalendarEventsModelForLeagues = new List<EventsForLeagueOutModel>(); dataObject.LeagueGroups = new List<LeagueGroup>(); dataObject.Documents = new List<Document>(); dataObject.Tournaments = new List<Tournament>(); //dataObject.MobileNotifications = new List<MobileNotification>(); cache["SiteCache"] = dataObject; } } } return dataObject; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }