title: prevent ejection of output cached page
body: <p>I'm trying to prevent output cached page from being ejected from my asp.net output cache unless another one can replace it.  In other words, if a page has expired (based on Duration property of OutputCache profile) but accessing the page now results in an exception, I just want to serve the old, outdated page.  I was hoping the custom cache providers in ASP.NET 4 would help my situation but they don't get far enough up the pipeline.</p>
  
  <p>Here's what I know:</p>
  
  <ul>
  <li>System.Web.Caching.OutputCache is really hard to read through</li>
  <li>A custom cache provider hooks in after all dependencies and is fed a CachedVary object.</li>
  <li>The utcExpiry date passed into the custom cache provider's Add and Set methods is just DateTime.Max</li>
  <li>The actual expiration of the cache item happens higher up in the pipeline</li>
  <li>Even for expired items, the custom cache provider's Get method is still called.  It returns the cached CachedVary object and then my controller's action method is called.  After this, the Add method is called with the CachedVary object and Set method is passed an actual cached page data object.</li>
  </ul>
  
  <p>Can someone with more experience hacking outputcache steer my in a direction here?  Can I accomplish what I'm looking for with ASP.NET outputcache?  Must I roll my own?</p>