Open sandboxFocus

Class JsonCachingSerializer

An implementation of ICachingSerializer based on JsonSerializer.

Inheritance
JsonCachingSerializer
Implements
Namespace: Metalama.Patterns.Caching.Serializers
Assembly: Metalama.Patterns.Caching.Backend.dll
Syntax
public class JsonCachingSerializer : ICachingSerializer
Remarks

This serializer stores the assembly-qualified type name along with the JSON payload, allowing for polymorphic deserialization of cached values.

To customize type name resolution (for example, for type forwarding scenarios), override the GetTypeName(Type) and ResolveTypeName(string) methods.

Constructors

Name Description
JsonCachingSerializer(JsonSerializerOptions?)

Initializes a new instance of the JsonCachingSerializer class.

Methods

Name Description
Deserialize(BinaryReader)

Deserializes a byte array into an object.

GetTypeName(Type)

Gets the type name to store in the serialized data. Override to customize type name mapping.

ResolveTypeName(string)

Resolves a type name from the serialized data back to a Type. Override to customize type resolution.

Serialize(object?, BinaryWriter)

Serializes an object into a byte array.

Extension Methods

See Also