Output / Response Caching in ASP.NET 5

Output Caching works quite similiar in ASP.NET 5 to previous versions.

Example:

 

 

This will add the Cache-control header with max-age=120. (seconds)

You can define profiles and use them instead of repeating.

Example:

 

 

 

 

If you want configure more:

 

The ResponseCacheAttribute got the following properties:

 

Duration: Gets or sets the duration in seconds for which the response is cached.

Location: Gets or sets the location where the data from a particular URL must be cached.

NoStore: Gets or sets the value which determines whether the data should be stored or not. If true the Cache-control header will be set to no-store.

VaryByHeader: Gets or sets the value for the Vary response header.

CacheProfileName: Gets or sets the value of the cache profile name.

Order: Gets or sets the order of the filter.

 

 



Mahmut Jomaa is a Software Engineer from Germany.

Currently he attends university to gain more knowledge in Computer Science.


Comments
Muqeem
0 # Mr 2016-04-26 10:48 – Muqeem
it is not working for me
Reply | Reply with quote | Quote
Security code Refresh