I am creating a forum package for cms and looking at caching some requests to help with performance, but I'm not sure that caching below will help / do what should be at the bottom (BTW: Cachehelper is a simple helper class that just adds and removes from cache)
IEnumerable<ForumTopic> maintopics;
if (!CacheHelper.Get(topicCacheKey, out maintopics))
{
maintopics = from t in u.ForumTopics
where t.ParentNodeId == CurrentNode.Id
orderby t.ForumTopicLastPost descending
select t;
CacheHelper.Add(maintopics, topicCacheKey);
}
var pagedResults = new PaginatedList<ForumTopic>(maintopics, p ?? 0, Convert.ToInt32(Settings.ForumTopicsPerPage));
rptTopicList.DataSource = pagedResults;
rptTopicList.DataBind();
Is linq only executed when it is enumerated? So it won't work? as its only listing, when I pass it to the paging assistant, which: .Take () a certain number of entries based on the value of querystring 'p'
source
share