I am trying to learn how to reuse my Linqtotwitter result for reuse in my application. Everything works fine except I am going to hit the ratelimit very quickly if I dont do a form of caching. I have 3 queries in my application that hits the twitter feed.
I tried to use the respository pattern at http://ardalis.com/introducing-the-cachedrepository-pattern but its way over my head and lets just say i didnt get far.
A sample controller from my code
[HttpGet]
public ActionResult PublicShouts()
{
var twitterCtx = new TwitterContext(Auth);
List<TweetViewModel> friendstweets = (from tweet in twitterCtx.Status
where tweet.Type == StatusType.User &&
tweet.ScreenName == "BattleShouts" &&
// tweet.InReplyToScreenName == "Battleshouts" &&
tweet.IncludeEntities == true &&
tweet.IncludeRetweets == true &&
tweet.IncludeContributorDetails == true &&
tweet.CreatedAt < DateTime.Now.AddDays(-30).Date
select new TweetViewModel
{
ImageUrl = tweet.User.ProfileImageUrl,
ScreenName = tweet.User.Identifier.ScreenName,
Tweet = tweet.Text
})
.ToList();
return PartialView(friendstweets);
I have also looked at this post How to cache data in a MVC application
How can I go about caching my results for later reuse so I dont hit the twitter limit?
Thank you