Is there a good reason to use cache (HttpRuntime.Cache) every time data is requested by the user?
For example, this is a method i use to retrieve comments from database:
public List<Comment> GetAllComments(int PageIndex, int PageSize)
string key = CacheKey + "Get_AllComments_" + PageIndex + "_" + PageSize;
if (EnableCaching && (Cache[key] != null))
var comments = (from comment in Contentctx.Comments
).OrderBy(p => p.AddedDate).Skip(PageSize * PageIndex).Take(PageSize).ToList();
CacheData(key, comments, CacheDuration);
I store in the cache dictionary every request including the paging.
Is it a good practice or is it a waste?
View Complete Post