ASP.NET Caching Provider

Learn what a cache provider is in ASP.NET Core and how to use Cosmos DB as a distributed cache storage.

Cache providers

Caching is a critical aspect of software development. Often, we need to optimize processes of storing and reusing specific information. Usually, it’s a key-value map. Microsoft makes our life easier by supporting caching out of the box in .NET Core:

  • In-memory caching

  • Distributed caching

In-memory cache

The easiest way to implement a cache is through an in-memory cache. The data is stored within the application memory. To enable it, we need to add the following to the Startup class.

Get hands-on with 1200+ tech skills courses.