EasyMemoryCache 2.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EasyMemoryCache --version 2.0.6
NuGet\Install-Package EasyMemoryCache -Version 2.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyMemoryCache" Version="2.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyMemoryCache --version 2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasyMemoryCache, 2.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasyMemoryCache as a Cake Addin #addin nuget:?package=EasyMemoryCache&version=2.0.6 // Install EasyMemoryCache as a Cake Tool #tool nuget:?package=EasyMemoryCache&version=2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EasyMemoryCache
.NET Component to easily implement MemoryCache (sync and async) for your .NET Core Application
How to Use:
Open Package Manager Console and run:
Install-Package EasyMemoryCache
Usage:
First, register the component in your Application:
.AddEasyCache(new CacheSettings() { ... })
.NET Core Console Example
//setup our DI
var serviceProvider = new ServiceCollection()
.AddEasyCache(new CacheSettings() { ... })
.BuildServiceProvider();
var caching = serviceProvider.GetService<ICaching>();
return caching;
ASP.NET Core Example (Startup.cs)
services.AddEasyCache(Configuration.GetSection("CacheSettings").Get<CacheSettings>());
Configuration example: (Redis)
"CacheSettings": {
"CacheProvider": "Redis",
"IsDistributed": true,
"RedisConnectionString": "localhost:6379,password=xxx=,ssl=False,abortConnect=False"
}
For MemoryCache
"IsDistributed": false,
"CacheProvider": "MemoryCache",
InMemory cache will be used instead of Redis
Then inject the interface where do you want to use, for example:
private readonly ICaching _caching;
private string UserKeyCache => "UserKey";
public UserService(ICaching caching)
{
_caching = caching;
}
Async:
var lstStringFromAsync = await _caching.GetOrSetObjectFromCacheAsync(CacheKeyNameForAsync, 20, ReturnListOfStringAsync);
With parameters:
var lstStringFromAsync = await _caching.GetOrSetObjectFromCacheAsync(CacheKeyNameForAsync, 20, () => ReturnListOfStringAsync(param));
Sync:
var lstString = _caching.GetOrSetObjectFromCache(CacheKeyName, 20, ReturnListOfString);
Check the code sample in the src directory
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- AsyncKeyedLock (>= 7.0.0)
- Backport.System.Threading.Lock (>= 1.0.2)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 8.0.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Newtonsoft.Json.Bson (>= 1.0.2)
- protobuf-net (>= 3.2.30)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
net7.0
- AsyncKeyedLock (>= 7.0.0)
- Backport.System.Threading.Lock (>= 1.0.2)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 8.0.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Newtonsoft.Json.Bson (>= 1.0.2)
- protobuf-net (>= 3.2.30)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
net8.0
- AsyncKeyedLock (>= 7.0.0)
- Backport.System.Threading.Lock (>= 1.0.2)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 8.0.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Newtonsoft.Json.Bson (>= 1.0.2)
- protobuf-net (>= 3.2.30)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
net9.0
- AsyncKeyedLock (>= 7.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 8.0.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Newtonsoft.Json.Bson (>= 1.0.2)
- protobuf-net (>= 3.2.30)
- System.Threading.Tasks.Extensions (>= 4.5.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EasyMemoryCache:
Package | Downloads |
---|---|
AlertHawk.Monitoring.Domain
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.9 | 397 | 10/13/2024 |
2.0.8 | 452 | 9/13/2024 |
2.0.7 | 743 | 8/21/2024 |
2.0.6 | 183 | 8/12/2024 |
2.0.5 | 160 | 7/30/2024 |
2.0.4 | 1,260 | 6/21/2024 |
2.0.3 | 1,307 | 4/11/2024 |
2.0.2 | 1,242 | 2/7/2024 |
2.0.1 | 746 | 1/15/2024 |
2.0.0 | 860 | 12/25/2023 |
1.0.35 | 2,714 | 11/3/2023 |
1.0.34 | 1,811 | 8/13/2023 |
1.0.33 | 3,561 | 5/6/2023 |
1.0.32 | 149 | 5/5/2023 |
1.0.31 | 2,128 | 2/27/2023 |
1.0.30 | 232 | 2/24/2023 |
1.0.29 | 226 | 2/24/2023 |
1.0.28 | 243 | 2/24/2023 |
1.0.27 | 2,274 | 12/9/2022 |
1.0.26 | 639 | 11/28/2022 |
1.0.25 | 1,838 | 10/21/2022 |
1.0.24 | 5,650 | 3/30/2022 |
1.0.23 | 407 | 3/24/2022 |
1.0.22 | 428 | 3/21/2022 |
1.0.21 | 417 | 3/21/2022 |
1.0.20 | 1,539 | 1/19/2022 |
1.0.19 | 439 | 1/18/2022 |
1.0.18 | 425 | 1/18/2022 |
1.0.17 | 376 | 12/8/2021 |
1.0.16 | 1,257 | 7/13/2021 |
1.0.15 | 1,563 | 2/18/2021 |
1.0.14 | 526 | 2/10/2021 |
1.0.13 | 389 | 1/30/2021 |
1.0.12 | 316 | 1/30/2021 |
1.0.11 | 311 | 1/30/2021 |
1.0.10 | 2,508 | 8/1/2020 |
1.0.9 | 421 | 8/1/2020 |
1.0.8 | 1,832 | 12/18/2019 |
1.0.7 | 684 | 9/24/2019 |
1.0.6 | 872 | 7/18/2019 |
1.0.5 | 536 | 7/17/2019 |
1.0.4 | 519 | 7/17/2019 |
1.0.3 | 551 | 7/17/2019 |
1.0.2 | 528 | 7/17/2019 |
1.0.1 | 514 | 7/17/2019 |
1.0.0 | 549 | 7/15/2019 |
.NET 9 support + Performance improvements