How it works...

Caching can improve our application's load time significantly. Mostly, we cache the output of a request, such as HTML and Json.

Do not cache frequently-changed data, it's more problematic to invalidate cache before it's time-to-live duration.

The cache TagHelper basically cache the output of inner blocks output. Caching mechanism by default, cache the inner blocks output in single instance.

We can increment the instance count by several parameters, such as vary-by-header, vary-by-cookie, and so on.

Those parameters create new cache instances for every different values for corresponding parameter keys, such as, vary-by-query parameter can create new cache instances for q=aspnetcore, u=polatengin, fruit=orange querystrings ...

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.