MethodCache.Serialization.MessagePack
1.0.0-rc.1
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
<PackageReference Include="MethodCache.Serialization.MessagePack" Version="1.0.0-rc.1" />
<PackageVersion Include="MethodCache.Serialization.MessagePack" Version="1.0.0-rc.1" />
<PackageReference Include="MethodCache.Serialization.MessagePack" />
paket add MethodCache.Serialization.MessagePack --version 1.0.0-rc.1
#r "nuget: MethodCache.Serialization.MessagePack, 1.0.0-rc.1"
#:package MethodCache.Serialization.MessagePack@1.0.0-rc.1
#addin nuget:?package=MethodCache.Serialization.MessagePack&version=1.0.0-rc.1&prerelease
#tool nuget:?package=MethodCache.Serialization.MessagePack&version=1.0.0-rc.1&prerelease
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
DateTimevalues as they are, and read stored data withMessagePackSecurity.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
MessagePackSerializerOptionstoAddMethodCacheMessagePack(options)to change them. KeepUntrustedDataand 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 | Versions 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. |
-
net10.0
- MessagePack (>= 3.1.11)
- MethodCache (= 1.0.0-rc.1)
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 |