Skip to content

Instantly share code, notes, and snippets.

@Shazwazza
Created September 10, 2014 00:01
Show Gist options
  • Save Shazwazza/931885e682b8fe34220e to your computer and use it in GitHub Desktop.
Save Shazwazza/931885e682b8fe34220e to your computer and use it in GitHub Desktop.
CachedPartial with contextualKeyBuilder
@Html.CachedPartial(
//partial view name
"myPartialView",
//the model to pass the view - this will be the same object passed to the contextualKeyBuilder delegate
Model,
//seconds to cache
123,
//the key builder delegate, accepts the model passed in to the cached partial and the current
// viewdata dictionary of the partial view
contextualKeyBuilder: (model, viewdata) =>
"some key, you can use the model and viewdata data to build the key if you want")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment