Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Microsoft.Extensions.Caching and System.Runtime.Caching?

Tags:

.net

wpf

There are two packages for In-Memory Caching:

  • Microsoft.Extensions.Caching
  • System.Runtime.Caching

Which one is the most efficient for the WPF .NET Framework?

like image 689
Arun Chaulagain Avatar asked Feb 11 '26 23:02

Arun Chaulagain


1 Answers

It depends on what framework you are using WPF on.

If using .NET Framework 4.6.0 or below, you won't be able to use the features of .NET Standard 2.0 as it targets .NET Standard 1.3.

In that case, use System.Runtime.Caching.

If not, then you will be targeting .NET Standard 2.0 with any version of .NET Framework starting 4.6.1 & any version of .NET Core from 2.0 and onwards.

In these scenarios, use Microsoft.Extensions.Caching.Memory as it's recommended over System.Runtime.Caching in all other circumstances:

Use System.Runtime.Caching/MemoryCache as a compatibility bridge when porting code from ASP.NET 4.x to ASP.NET Core.

like image 85
Ermiya Eskandary Avatar answered Feb 15 '26 14:02

Ermiya Eskandary



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!