コード例 #1
0
 private static GameCache UpdateCache(GameCache siteCache)
 {
     try
     {
         lock (ThisLock)
         {
             HttpContext.Current.Cache["GameCache"] = siteCache;
         }
         return siteCache;
     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return null;
 }
コード例 #2
0
        private static GameCache GetCache(System.Web.Caching.Cache cache)
        {
            try
            {
                GameCache dataObject = (GameCache)cache["GameCache"];
                if (dataObject == null)
                {
                    lock (ThisLock)
                    {
                        dataObject = (GameCache)cache["GameCache"];
                        if (dataObject == null)
                        {
                            dataObject = new GameCache();
                            dataObject.GamesForRollerDerby = new List<GameViewModel>();
                            dataObject.CurrentGamesGettingAdded = new List<GameViewModel>();
                            dataObject.CurrentLiveGames = new List<GameViewModel>();
                            dataObject.CurrentLiveDebuggingGames = new List<GameViewModel>();

                            cache["GameCache"] = dataObject;
                        }
                    }

                }
                return dataObject;
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return null;
        }