坚持页面输出缓存

问题描述:

即使在IIS重新启动或修改web.config之后,是否也可以使页面输出缓存保持不变?

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.

您可以通过实现OutputCacheProvider来实现自己的outputcache提供器:

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);
 }

有关进一步的阅读和实施方法,请阅读:创建-custom-output-cache-provider

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

要阅读的更多资源: scottgu可扩展输出缓存与asp-net-4-vs-2010-and-net-4-0系列