How do I use VaryByParam with multiple parameters?

In ASP.NET MVC2 I use OutputCache and the VaryByParam attribute. I got it working fine with a single parameter, but what is the correct syntax when I have several parameters on the method?

[OutputCache(Duration=30, VaryByParam = "customerId"]
public ActionResult Index(int customerId)
{
//I've got this one under control, since it only has one parameter
}

[OutputCache(Duration=30, VaryByParam = "customerId"]
public ActionResult Index(int customerId, int languageId)
{
//What is the correct syntax for VaryByParam now that I have a second parameter?
}

How do I get it to cache the pages using both parameters? Do I enter add the attribute twice? Or write “customerId, languageId” as the value??

How do I use str_replace() with multiple parameters?

Basically, I want to use both $city_name and $ref_name with str_replace(), so that if either one (or both) of them are inputted by the user, both of them are replaced with their actual variable forms.

How do I use multiple parameters with the performSelector: method? [duplicate]

This question already has an answer here: iOS performSelectorOnMainThread with multiple arguments 3 answers Do I use withObject:? And if so, could I just pass, say an NSNumber? How would it app

How do I cache at both client & server when VaryByParam != “none”?

I’m looking for a way to cache a page at both the client and the server while varying the server’s output cache by a querystring parameter Version. With this tag: <%@ OutputCache Duration=10 Lo

How To use any Parameter value for VaryByParam in caching page?

<%@ OutputCache Duration=10 VaryByParam=Button1 %> I type the above code to vary text of Button but it does not vary the value .

How do I use tabulate with multiple named parameters in Scala?

Background I see examples like: val squares = List.tabulate(6)(n => n * n) // one parameter, named parameter val mul = List.tabulate(4,5)( _ * _ ) // two parameters, unnamed parameters Question Wh

How can I pass multiple parameters and use them?

Hi I’m new to myBatis. I’m using MyBatis and Spring with mybatis-spring. How can I pass two different types of objects as parameters, and how can I use their properties in query? <update id=update

How do I use variable numbers of parameters in PHP? [duplicate]

Possible Duplicate: PHP function with unlimited number of parameters How to pass array as multiple parameters to function? I want to create a function with a variable number of parameters in PHP, ki

How do I use a Maven assembly in multiple projects?

I’ve got a Maven assembly that I want to use in multiple projects. How do I reuse it without hardcoding the path?

F#: How do I declare and use ByRef semantics on parameters?

I am wraping some SQL Stored Procs with in/out parameters. This of course means I have to do ugly stuff like declare my parameters as by reference and use mutables. How would I do this in F#?

How do I use prepared statements for inserting MULTIPLE records in SQlite using Python / Django?

How do I use prepared statement for inserting MULTIPLE records in SQlite using Python / Django?

Answers

You can use * for all parameters or a semi-colon separated list (VaryByParam = “customerId;languageId”).

You can also use none if you didn’t want it to cache different versions….

Here’s a nice write up specifically for MVC.