0
我想了解如何重用我的Linqtotwitter结果以便在我的应用程序中重用。 一切工作正常,除非我打算速度限制非常迅速,如果我不做一种形式的缓存。我在我的应用程序中有3个查询触发了twitter feed。缓存Linq重用结果MVC 3
我试图使用http://ardalis.com/introducing-the-cachedrepository-pattern的知识库模式,但它在我头上的方式,让我只是说我没有得到太多。
样本控制器从我的代码
[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);
我也看了这个帖子How to cache data in a MVC application
我怎么能去缓存我以备后用,所以我不打了极限Twitter的结果?
谢谢
缓存控制器的行为,而不是重复使用的结果,我也使用它。 – 2012-03-20 20:49:13
如果你想缓存'List'看看'ConcurrentDictionary' –
2012-03-20 21:14:33
我可以使用类似这样的东西http://stackoverflow.com/questions/7540257/how-to-cache-mvc3-webgrid-results-如此即排序的点击不能?我不遵循你的服用方向。并发字典带我穿线 – 2012-03-21 02:14:02