コード例 #1
0
ファイル: FeedApi.cs プロジェクト: julthep/CommunityServer
        public object GetFreshNewsCount()
        {
            var cacheKey        = GetNewFeedsCountKey();
            var resultfromCache = newFeedsCountCache.Get <String>(cacheKey);
            int result;

            if (!int.TryParse(resultfromCache, out result))
            {
                var lastTimeReaded = new FeedReadedDataProvider().GetTimeReaded();
                result = FeedAggregateDataProvider.GetNewFeedsCount(lastTimeReaded);
                newFeedsCountCache.Insert(cacheKey, result.ToString(), DateTime.UtcNow.AddMinutes(3));
            }
            return(result);
        }
コード例 #2
0
        private int GetUserFeedsCount()
        {
            int count = 0;

            try
            {
                var lastTimeReaded = feedReadedProvider.GetTimeReaded();
                count = FeedAggregateDataProvider.GetNewFeedsCount(lastTimeReaded);
            }
            catch (Exception ex)
            {
                log.ErrorFormat("GetNewFeedsCount error: {0}, {1}", ex.StackTrace, ex.ToString());
            }

            return(count);
        }