Mathias F
Mathias F

Reputation: 15901

Caching with variation by RouteValue

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 OutputCache 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

Upvotes: 0

Views: 158

Answers (1)

maartenba
maartenba

Reputation: 3384

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.

Upvotes: 1

Related Questions