MethodCache.Serialization.MessagePack 1.0.0-rc.1

This is a prerelease version of MethodCache.Serialization.MessagePack.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MethodCache.Serialization.MessagePack --version 1.0.0-rc.1
                    
NuGet\Install-Package MethodCache.Serialization.MessagePack -Version 1.0.0-rc.1
                    
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="MethodCache.Serialization.MessagePack" Version="1.0.0-rc.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MethodCache.Serialization.MessagePack" Version="1.0.0-rc.1" />
                    
Directory.Packages.props
<PackageReference Include="MethodCache.Serialization.MessagePack" />
                    
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 MethodCache.Serialization.MessagePack --version 1.0.0-rc.1
                    
#r "nuget: MethodCache.Serialization.MessagePack, 1.0.0-rc.1"
                    
#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 MethodCache.Serialization.MessagePack@1.0.0-rc.1
                    
#: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=MethodCache.Serialization.MessagePack&version=1.0.0-rc.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MethodCache.Serialization.MessagePack&version=1.0.0-rc.1&prerelease
                    
Install as a Cake Tool

MethodCache.Serialization.MessagePack

Requires .NET 10 and the .NET 10 SDK; use the same package version as MethodCache.

Install this package and MethodCache at the exact same version. Integration packages use Core internals; do not override their exact Core dependency. Our package smoke tests promote NU1608 to a restore error.

In cache keys, collection subclasses include their own public properties and fields as well as their elements in the key. Collections with different scope or tenant state cannot share a cached result.

Stores MethodCache's distributed cache values (Redis or SQL Server) as compact MessagePack instead of the default System.Text.Json: smaller entries and faster reads.

Install

dotnet add package MethodCache.Serialization.MessagePack

Register

builder.Services.AddMethodCache();
builder.Services.AddMethodCacheRedis("localhost:6379");
builder.Services.AddMethodCacheMessagePack();   // MethodCache.Serialization.MessagePack

Call AddMethodCacheMessagePack() with AddMethodCacheRedis(), AddMethodCacheSqlServer(), in any order. Entries written in the other format read as misses and are replaced, so switching needs no flush.

When to use it

  • Values are large or read often from the distributed cache. It has no effect on the in-memory cache, which stores your objects as they are.
  • Types serialize without attributes (contractless resolver). The defaults use LZ4 compression, keep DateTime values as they are, and read stored data with MessagePackSecurity.UntrustedData.
  • Like JSON, the contractless resolver doesn't restore private setters or a derived type returned as its base type. With the default VerifyRoundTrip = true, MethodCache reads every value back before sharing it, and keeps values that don't survive that in memory only, with one warning per method and type.
  • Pass your own MessagePackSerializerOptions to AddMethodCacheMessagePack(options) to change them. Keep UntrustedData and don't enable typeless payloads: the distributed cache must not choose which types get created (see Security).

Key generator (optional)

Use UseMessagePack() to select distributed value serialization. Cache-key construction remains runtime-owned; use ICacheKeyProvider for custom argument parts. The former public key generator is internal.

The check cannot detect lost nested derived/private state that was absent from the first serialized representation. Configure the serializer for your model. Increment method Version or DistributedCacheOptions.SerializerVersion when changing the representation.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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

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.0.0-rc.2 58 10/20/2026
1.0.0-rc.1 60 10/19/2026