Using IMemoryCache to cache data in-memory using .NET 5 [An Introduction]

Using IMemoryCache to cache data in-memory using .NET 5 [An Introduction]

I am going to walk through how to cache data in-memory using the IMemoryCache interface in .NET 5.

In this video, I am going to walk through how to cache data in-memory using the IMemoryCache interface in .NET 5.

Caching is a very useful mechanism to easily increase the performance of any application.

Previously I have covered topics on distributed cache services.

An introduction to Memcached, a distributed caching server:

An introduction to Redis, a distributed caching server:

  • 00:05 - Introduction of what is caching
  • 02:45 - Explain the problem domain
  • 03:34 - Create a new class for implementing cache using IMemoryCache
  • 04:55 - Get an item from the cache using a key
  • 05:50 - Add item to the cache
  • 06:50 - Different overloads for adding cache
  • 07:15 - Elaborate MemoryCacheEntryOptions object
  • 07:35 - Explaining cache expiration and difference between sliding and absolute expiration policy
  • 09:20 - Explanation of how to avoid stale data forever when using sliding expiration
  • 10:15 - What is a post-eviction callback and how it can be useful
  • 11:00 - Cache priority
  • 11:15 - Size of the cache entry
  • 11:50 - Mechanism I follow to add items to the cache using TryGetValue method
  • 13:40 - Configuring dependency injection for IMemoryCache
  • 14:05 - Explaining the overloads for AddMemoryCache extension method for adding IMemoryCache to the dependency injection
  • 15:00 - explaining CompactionPercentage property
  • 16:05 - Update the API to use the cache provider to get data
  • 17:05 - Debug through the code and explain how the feature is working

dotnet developer

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.

Developer Career Path: To Become a Team Lead or Stay a Developer?

For a developer, becoming a team leader can be a trap or open up opportunities for creating software. Two years ago, when I was a developer, ... by Oleg Sklyarov, Fullstack Developer at Skyeng company

IDO Development | Initial DEX Offering Development | IDO Development Platform

The IDO development platform is the new trendsetter in the blockchain world. Investors can make their investments worthy by exploring the benefits of Initial DEX Offering tokens since their value is soaring high in the marketplace.

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

Mobile Wallet Development, eWallet App Development, Digital Wallet App Development

Get the most of what the digital world has to offer with our innovative range of Digital wallet app development services. Enable your customers to store, send, and receive funds with ease and security. A customizable offering that is highly efficient and scalable.