NTDLS.FastMemoryCache 1.9.2

dotnet add package NTDLS.FastMemoryCache --version 1.9.2
                    
NuGet\Install-Package NTDLS.FastMemoryCache -Version 1.9.2
                    
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="NTDLS.FastMemoryCache" Version="1.9.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NTDLS.FastMemoryCache" Version="1.9.2" />
                    
Directory.Packages.props
<PackageReference Include="NTDLS.FastMemoryCache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NTDLS.FastMemoryCache --version 1.9.2
                    
#r "nuget: NTDLS.FastMemoryCache, 1.9.2"
                    
#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.
#:package NTDLS.FastMemoryCache@1.9.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NTDLS.FastMemoryCache&version=1.9.2
                    
Install as a Cake Addin
#tool nuget:?package=NTDLS.FastMemoryCache&version=1.9.2
                    
Install as a Cake Tool

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.

PartitionedMemoryCache _cache = new();

public string ReadFileFromDisk(string path)
{
    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

MIT

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NTDLS.FastMemoryCache:

Package Downloads
NTDLS.KitKey.Server

A low latency, high-performance, and reliable persistent or ephemeral key-value store over TCP/IP.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.2 168 5/2/2025
1.9.1 149 3/2/2025
1.9.0 206 1/8/2025
1.7.14 111 1/8/2025
1.7.13 142 1/4/2025
1.7.12 165 1/4/2025
1.7.11 148 12/31/2024
1.7.10 149 12/3/2024
1.7.9 131 10/22/2024
1.7.8 139 10/13/2024
1.7.7 124 10/13/2024
1.7.6 138 10/13/2024
1.7.5 180 8/25/2024
1.7.4 169 8/24/2024
1.7.3 175 8/24/2024
1.7.2 156 8/24/2024
1.7.1 176 8/13/2024
1.7.0 108 8/3/2024
1.6.4 160 8/1/2024
1.6.3 120 8/1/2024
1.6.2 126 8/1/2024
1.6.1 120 8/1/2024
1.6.0 119 8/1/2024
1.5.4 120 8/1/2024
1.5.3 125 7/31/2024
1.5.2 154 6/20/2024
1.5.1 184 1/22/2024
1.5.0 212 12/7/2023
1.4.4 193 11/15/2023
1.4.3 173 11/10/2023
1.4.2 167 11/3/2023
1.4.1 180 10/17/2023
1.4.0 192 10/12/2023
1.3.0 190 10/11/2023

Dependency updates.