Currently I am working on an application with ~5000 different pages that all from the following method:
[OutputCache(Duration = 604800)]
public ActionResult Details(string alias){ //database connection and data retrieval - takes about 11 seconds }
This method takes long to run the first time - obviously, and while thinking of solutions to make this faster, I started to consider using long term server-side outputcaching since this database data does not change often and is not urgent when it does.
As I mentioned, there are a total of ~5000 different results from this Details method, so the cache will not be very large.
THE PROBLEM: after loading the site and running a site crawler, not all of the pages were cached. I'm assuming it's because the buffer for caching filled up and MVC started removing old caches to make way for new ones.
MY QUESTION: How can I tell ASP.net MVC to not clear out the cache ever - unless the expiration date (of a week) is hit? Or force persist OutputCache until expiration date?
Thanks everyone.
You're at the limit of your server - you will run into the same issues if you restart the machine or IIS.
Your best bet may be wrapping your calls in your own cache provider like this SO question. From there, you could store the OutputCache and also store at a db or nosql level.