NTDLS.FastMemoryCache
1.6.4
See the version list below for details.
dotnet add package NTDLS.FastMemoryCache --version 1.6.4
NuGet\Install-Package NTDLS.FastMemoryCache -Version 1.6.4
<PackageReference Include="NTDLS.FastMemoryCache" Version="1.6.4" />
paket add NTDLS.FastMemoryCache --version 1.6.4
#r "nuget: NTDLS.FastMemoryCache, 1.6.4"
// Install NTDLS.FastMemoryCache as a Cake Addin #addin nuget:?package=NTDLS.FastMemoryCache&version=1.6.4 // Install NTDLS.FastMemoryCache as a Cake Tool #tool nuget:?package=NTDLS.FastMemoryCache&version=1.6.4
NTDLS.FastMemoryCache
📦 Be sure to check out the NuGet package: https://www.nuget.org/packages/NTDLS.FastMemoryCache
Provides fast and easy to use thread-safe partitioned memory cache for C# that helps manage the maximum size and track performance.
👀 This memory cache was developed to deal with caches containing large numbers of items. When working on a database server written in C# we found that we had significant contention around the cache. This project was the solution. It also allowed us to better manage the size of the cache and enforce max memory constraints. That said, if you are only caching a few dozen items - stick with IMemoryCache.
Quick and easy example of a file cache:
Using the memory cache is easy, just initialize and upsert some values. You can also pass a configuration parameter to set max memory size, cache scavenge rate and partition count.
readonly PartitionedMemoryCache _cache = new();
public string ReadFileFromDisk(string path)
{
string cacheKey = path.ToLower();
if (_cache.TryGet<string>(cacheKey, out var cachedObject))
{
return cachedObject;
}
string fileContents = File.ReadAllText(path);
_cache.Upsert(cacheKey, fileContents, fileContents.Length * sizeof(char));
return fileContents;
}
License
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. |
-
net6.0
- NTDLS.Semaphore (>= 3.3.2)
-
net7.0
- NTDLS.Semaphore (>= 3.3.2)
-
net8.0
- NTDLS.Semaphore (>= 3.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.7.9 | 77 | 10/22/2024 |
1.7.8 | 92 | 10/13/2024 |
1.7.7 | 76 | 10/13/2024 |
1.7.6 | 86 | 10/13/2024 |
1.7.5 | 130 | 8/25/2024 |
1.7.4 | 122 | 8/24/2024 |
1.7.3 | 123 | 8/24/2024 |
1.7.2 | 113 | 8/24/2024 |
1.7.1 | 128 | 8/13/2024 |
1.7.0 | 67 | 8/3/2024 |
1.6.4 | 117 | 8/1/2024 |
1.6.3 | 70 | 8/1/2024 |
1.6.2 | 78 | 8/1/2024 |
1.6.1 | 77 | 8/1/2024 |
1.6.0 | 71 | 8/1/2024 |
1.5.4 | 75 | 8/1/2024 |
1.5.3 | 65 | 7/31/2024 |
1.5.2 | 109 | 6/20/2024 |
1.5.1 | 144 | 1/22/2024 |
1.5.0 | 183 | 12/7/2023 |
1.4.4 | 159 | 11/15/2023 |
1.4.3 | 148 | 11/10/2023 |
1.4.2 | 143 | 11/3/2023 |
1.4.1 | 149 | 10/17/2023 |
1.4.0 | 165 | 10/12/2023 |
1.3.0 | 159 | 10/11/2023 |
Significant performance optimizations. Added minimun memory size per partition.