Sam
Sam

Reputation: 30344

ASP.NET Core 2.1 API Caching

In my ASP.NET Core 2.1 API app, I have a few endpoints that return fairly static user data e.g. user avatar, etc.

I've already implemented Redis cache to save myself a trip to the database but I'd like to implement one more layer of caching to help reduce hits on my Redis cache as well.

What additional options do I have to cache some of this data so that I don't even have to go to Redis, unless I have to?

BTW, my app runs on Azure App Service so I don't have any control over server resources.

Upvotes: 3

Views: 723

Answers (1)

Frank Odoom
Frank Odoom

Reputation: 1566

You can take advantage of Asp.Net Core response caching by specifying the Cache-Control in your response header also Asp.Net Core supports AddMemoryCache which can be configured in Startp through dependency injection

services.AddMemoryCache();

This resource explains the various ways you can implement caching in Asp.Net Core 2.1

REFERENCE

Upvotes: 2

Related Questions