NTDLS.FastMemoryCache 1.4.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package NTDLS.FastMemoryCache --version 1.4.2                
NuGet\Install-Package NTDLS.FastMemoryCache -Version 1.4.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.4.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NTDLS.FastMemoryCache --version 1.4.2                
#r "nuget: NTDLS.FastMemoryCache, 1.4.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.
// Install NTDLS.FastMemoryCache as a Cake Addin
#addin nuget:?package=NTDLS.FastMemoryCache&version=1.4.2

// Install NTDLS.FastMemoryCache as a Cake Tool
#tool nuget:?package=NTDLS.FastMemoryCache&version=1.4.2                

NTDLS.FastMemoryCache

Provides fast and easy to use thread-safe partitioned memory cache for C# that helps manage the maximum size and track performance.

Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.FastMemoryCache/

Quick and easy eample 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 scavange 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

Apache-2.0

Product 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 was computed.  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 was computed.  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. 
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.0 149 1/8/2025
1.7.14 62 1/8/2025
1.7.13 101 1/4/2025
1.7.12 125 1/4/2025
1.7.11 108 12/31/2024
1.7.10 118 12/3/2024
1.7.9 101 10/22/2024
1.7.8 111 10/13/2024
1.7.7 96 10/13/2024
1.7.6 104 10/13/2024
1.7.5 146 8/25/2024
1.7.4 136 8/24/2024
1.7.3 139 8/24/2024
1.7.2 127 8/24/2024
1.7.1 144 8/13/2024
1.7.0 82 8/3/2024
1.6.4 131 8/1/2024
1.6.3 84 8/1/2024
1.6.2 92 8/1/2024
1.6.1 93 8/1/2024
1.6.0 86 8/1/2024
1.5.4 89 8/1/2024
1.5.3 79 7/31/2024
1.5.2 122 6/20/2024
1.5.1 153 1/22/2024
1.5.0 194 12/7/2023
1.4.4 168 11/15/2023
1.4.3 157 11/10/2023
1.4.2 152 11/3/2023
1.4.1 158 10/17/2023
1.4.0 174 10/12/2023
1.3.0 168 10/11/2023

Made scavenge and max size optional.