Repository navigation
AspNetCore
Furkan Güngör edited this page Jan 2, 2021
·
3 revisions
EasyCache.AspNetCore includes AutoCache attribute.
Installation
Choice any cache provider.(EasyCache.Memory, EasyCache.Redis, EasyCache.MemCache)
Install EasyCache.AspNetCore from Nuget
With the AutoCache feature, you can cache endpoints that do not change very often.
For example, you can use the country information for the endpoint you return.
/// <summary>
/// Get countries from cache
/// </summary>
/// <returns></returns>
[HttpGet("[controller]/countries")]
[AutoCache(typeof(CountryResponseDto[]), "products")]
public IActionResult AutoCache()
{
return Ok(new List<CountryResponseDto>
{
new CountryResponseDto
{
Name = "Country 1",
Description = "Country Description 1"
},
new CountryResponseDto
{
Name = "Country 2",
Description = "Country Description 2"
},
new CountryResponseDto
{
Name = "Country 3",
Description = "Country Description 3"
}
});
}Contents:
-
Home
-
Getting Started
-
Customization