I have an action in my MVC controller and I want to cache its return result based on the parameters passed as a key, so the next time this action is called, it will look in the cache first if it is not found, look in the data warehouse.
public ActionResult GetSearchResult(string zipcode, int pageSize, int currentPage)
{
Cache[zipcode + page + currentpage] = somedata
}
How can i do this? I can store data in a cache object as described above, but I want the cached objects to be cleared after 30 minutes. I can’t figure out how to set the lifetime either on a global basis or on each cached object.
source
share