NTDLS.FastMemoryCache 1.2.0

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

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

NTDLS.FastMemoryCache

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

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;
}
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5.1 116 1/22/2024
1.5.0 161 12/7/2023
1.4.4 123 11/15/2023
1.4.3 110 11/10/2023
1.4.2 112 11/3/2023
1.4.1 123 10/17/2023
1.4.0 132 10/12/2023
1.3.0 129 10/11/2023
1.2.0 125 10/10/2023
1.1.5 128 10/10/2023

Resovled issue with partiton mod calculations.