コード例 #1
0
 public IEnumerable<Status> FetchTweetsForFavorites(TwitterPart part) {
     var screenName = part.Parameter1.Trim();
     var count = part.Count;
     var context = CreateContext();
     return context.Favorites.Where(x =>
         x.ScreenName == screenName &&
         x.Count == count);
 }
コード例 #2
0
 public IEnumerable<Status> FetchTweetsForList(TwitterPart part) {
     var listId = (ulong)XmlHelper.Parse<long>(part.Parameter2.Trim());
     var count = part.Count;
     var context = CreateContext();
     return context.List.Where(x =>
         x.ListID == listId &&
         x.Count == count)
         .SelectMany(x => x.Statuses);
 }
コード例 #3
0
        public IEnumerable<Status> FetchTweetsForPart(TwitterPart part) {
            var cacheKey = CacheKeyPrefix + part.Id;

            return _cacheManager.Get(cacheKey, ctx => {
                ctx.Monitor(_signals.When(WellKnownSignals.TwitterPartChanged));
                ctx.Monitor(_clock.When(TimeSpan.FromMinutes(part.CacheMinutes)));
                return FetchTweets(part).ToList();
            });
        }
コード例 #4
0
        protected IEnumerable<Status> FetchTweets(TwitterPart part) {
            IEnumerable<Status> tweets;

            switch (part.FeedType) {
                case (int)FeedType.Profile:
                    tweets = FetchTweetsForScreenName(part);
                    break;
                case (int)FeedType.List:
                    tweets = FetchTweetsForList(part);
                    break;
                case (int)FeedType.Favorites:
                    tweets = FetchTweetsForFavorites(part);
                    break;
                default:
                    tweets = FetchTweetsForSearch(part);
                    break;
            }

            return tweets;
        }
コード例 #5
0
 public IEnumerable<Status> FetchTweetsForSearch(TwitterPart part) {
     return FetchTweetsForSearch(part.Parameter1, part.Count);
 }