开发者

Caching with variation by RouteValue

开发者 https://www.devze.com 2022-12-19 07:28 出处:网络
I have an Action that has diferent results depending on some route value. ie www.mysite.com/Home/About/Value1 is different then www.mysite.com/Home/About/Value2.

I have an Action that has diferent results depending on some route value.

ie www.mysite.com/Home/About/Value1 is different then www.mysite.com/Home/About/Value2.

Is there any chance I can use OutputCac开发者_开发问答he on the action About in controller Home with diferent output for www.mysite.com/Home/About/Value1 and www.mysite.com/Home/About/Value2? I know I can use caching on model level, but I want to use OutputCache on the action.

EDIT

www.mysite.com/Home/About/Value1 and then www.mysite.com/Home/About/Value2 actually have different cache entries as stated by Levi


Simply add the [OutputCache()] attribute to your About action method. If you want to vary it, you can use one of the parameters in the OutputCache attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消