Home > front end >  Microsoft.Extensions.Caching vs System.Runtime.Caching
Microsoft.Extensions.Caching vs System.Runtime.Caching

Time:10-11

There are two packages for the In Memory Caching (Microsoft.Extensions.Caching and System.Runtime.Caching). Which one is most efficient for the WPF .NET Framework?

CodePudding user response:

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.

  •  Tags:  
  • .net
  • Related