Check the VaryByParam property of the OutputCache attribute.
[OutputCache(Duration=int.MaxValue, VaryByParam="id")]
public ActionResult Details(int id)
{
}
For each unique id value, a unique cache instance will be created.
Edit:
VaryByParam, VaryByCustom. ( , ..).