コード例 #1
0
        /// <summary>
        /// Get answer description flags data from cache or initialize if empty
        /// </summary>
        /// <returns></returns>
        private KeyIndexedDataSource <AnswerDescriptionFlag> GetUserDescriptionFlagsCachedData()
        {
            object data = _cacheManager.Get(CacheConstants.CACHE_KEY_USER_DESCRIPTION_FLAGS_DATA);

            if (data == null)
            {
                var dataSource = new KeyIndexedDataSource <AnswerDescriptionFlag>();
                dataSource.Initialize(_answerDescriptionFlagRepository.Active());
                _cacheManager.Add(CacheConstants.CACHE_KEY_USER_DESCRIPTION_FLAGS_DATA, dataSource);
                return(dataSource);
            }
            return((KeyIndexedDataSource <AnswerDescriptionFlag>)data);
        }
コード例 #2
0
        /// <summary>
        /// Get votes data from cache or initialize if empty
        /// </summary>
        /// <returns></returns>
        private KeyIndexedDataSource <AnswerVote> GetVotesCachedData()
        {
            object data = _cacheManager.Get(CacheConstants.CACHE_KEY_VOTES_DATA);

            if (data == null)
            {
                var dataSource = new KeyIndexedDataSource <AnswerVote>();
                dataSource.Initialize(_answerVoteRepository.Active());
                _cacheManager.Add(CacheConstants.CACHE_KEY_VOTES_DATA, dataSource);
                return(dataSource);
            }
            return((KeyIndexedDataSource <AnswerVote>)data);
        }