MethodCache.Serialization.MessagePack 1.0.0-rc.2

This is a prerelease version of MethodCache.Serialization.MessagePack.
dotnet add package MethodCache.Serialization.MessagePack --version 1.0.0-rc.2
                    
NuGet\Install-Package MethodCache.Serialization.MessagePack -Version 1.0.0-rc.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="MethodCache.Serialization.MessagePack" Version="1.0.0-rc.2" />
                    
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.2" />
                    
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.2
                    
#r "nuget: MethodCache.Serialization.MessagePack, 1.0.0-rc.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 MethodCache.Serialization.MessagePack@1.0.0-rc.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=MethodCache.Serialization.MessagePack&version=1.0.0-rc.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MethodCache.Serialization.MessagePack&version=1.0.0-rc.2&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.

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(mc => mc
    .UseRedis("localhost:6379")
    .UseMessagePack());   // MethodCache.Serialization.MessagePack

Call UseMessagePack() with UseRedis(...) or UseSqlServer(...), in any order; without either it does nothing and logs a warning at startup. 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.
  • To change them, start from MethodCache's defaults: UseMessagePack(o => o.WithCompression(MessagePackCompression.None)) gets the defaults above and returns the options to use, so the rest stays as it was. Keep UntrustedData and don't enable typeless payloads: the distributed cache must not choose which types get created (see Security).
  • UseMessagePack changes how values are stored, never cache keys. Use ICacheKeyProvider for custom argument parts.

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