我们设法使用 App Fabric 缓存服务器来存储我们的 Outputcache
,无需更改我们的代码,只需进行配置。而且效果很好。
有没有办法对 .Net 缓存 (HttpContext.Current.Cache
) 做同样的事情?无需更改我们的代码,只需配置即可。
谢谢
最佳答案
HttpContext Cache 没有提供者抽象 ( ProviderBase
)。正如@Icarus 所指出的那样,有 OutputCache 和 Session。这将需要更改代码。
这里有一些想法给你......
- 使用 AppFabric
DataCache
而不是HttpContext.Current.Cache
。参见 Hanselmans example . - 使用 HttpContext 缓存(应用程序缓存)将任何内容转换为 session (用户缓存)。
- 参见 related SO post regarding building a custom Cache provider .
关于asp.net - 无论如何告诉.net 缓存使用应用程序结构服务器而不是本地内存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10537671/