【发布时间】:2013-01-23 07:59:54
【问题描述】:
我希望缓存我的 mvc 3 应用程序中的图像。我在 web.config 中写了一个缓存配置文件:
caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="ImageCache" duration="10" location="Server" noStore="true"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
并在返回图片的方法中添加了OutputCacheAttribute:
[OutputCache(CacheProfile = "ImageCache")]
public FileContentResult GetImage(int productId) { /* implementation */ }
问题:
1) 如何验证图片是否缓存?
2) 最好的位置是什么:客户端、服务器还是任何?我的应用程序是一个网上商店,每张图片都附在产品上。我认为每个用户都应该看到相同的缓存内容。有什么建议吗?
3)也许这个真的很傻:客户端和浏览器缓存有什么区别?
提前感谢您的帮助!
【问题讨论】:
标签: asp.net asp.net-mvc asp.net-mvc-3 caching