0

Is there an option to make page outputcache persist even after IIS restart or web.config modification?

Right now when I upload files the site recompiles and the outputcache resets and get cached upon the next page request.

DeanOC
  • 7,142
  • 6
  • 42
  • 56
Liron Harel
  • 10,819
  • 26
  • 118
  • 217
  • 1
    sure, but you can't depend on the app memory (where sessions and cache reside by default) as an app reset, will clear both ... [I've written some years ago an answer](https://stackoverflow.com/a/14047758/28004) that you can take advantage for your problem. – balexandre Jun 25 '17 at 20:51

1 Answers1

1

You can implement your own outputcache provider by implementing the OutputCacheProvider:

public abstract class OutputCacheProvider : ProviderBase
 {
   public abstract object Get(string key);
   public abstract object Add(string key, object entry, DateTime utcExpiry);
   public abstract void Set(string key, object entry, DateTime utcExpiry);
   public abstract void Remove(string key);
 }

For further reading and how to implement you can read: creating-a-custom-output-cache-provider

More resources to read: scottgu extensible-output-caching-with-asp-net-4-vs-2010-and-net-4-0-series

Peter
  • 27,590
  • 8
  • 64
  • 84