private static ForumTopicCache GetCache(System.Web.Caching.Cache cache, Guid forumId, long TopicId) { try { ForumTopicCache dataObject = (ForumTopicCache)cache["ForumTopicCache-" + forumId + "-" + TopicId]; if (dataObject == null) { dataObject = (ForumTopicCache)cache["ForumTopicCache-" + forumId + "-" + TopicId]; if (dataObject == null) { dataObject = new ForumTopicCache(); dataObject.Topic = new ForumTopic(); dataObject.Forum = new Forum(); dataObject.Forum.ForumId = forumId; cache["ForumTopicCache-" + forumId + "-" + TopicId] = dataObject; } } return dataObject; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }
private static ForumTopicCache UpdateCache(ForumTopicCache forumCache) { try { lock (ThisLock) { HttpContext.Current.Cache["ForumTopicCache-" + forumCache.Forum.ForumId + "-" + forumCache.Topic.TopicId] = forumCache; } return forumCache; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }