Table of Contents

Method UseJsonSerialization

Namespace
Scaleout.Client
Assembly
Scaleout.Client.dll

UseJsonSerialization(JsonSerializerOptions)

Configures the cache to use System.Text.Json for serialization/deserialization of objects in the cache.

public CacheBuilder<TKey, TValue> UseJsonSerialization(JsonSerializerOptions jsonOptions)

Parameters

jsonOptions JsonSerializerOptions

Options to control the behavior of the JSON serializer.

Returns

CacheBuilder<TKey, TValue>

A builder object that can be used to further configure the cache.

Remarks

This method will override any previously set serialization methods.

This method is intended for easy configuration of the cache to use JSON serialization and is best suited for simple "POCO" types. For more complex types, or for types that require custom serialization behavior, you may need to provide a custom serializer or use attributes to control serialization behavior.

Note that the JSON serializer may not handle all types correctly, especially those with complex or circular references. By default, System.Text.Json will only serialize public properties. If your type has private fields or properties that need to be serialized, you may need to provide a custom converter or use attributes to control serialization behavior. See System.Text.Json docs for more information.

See Also

UseJsonSerialization()

Configures the cache to use System.Text.Json for serialization/deserialization of objects in the cache.

public CacheBuilder<TKey, TValue> UseJsonSerialization()

Returns

CacheBuilder<TKey, TValue>

A builder object that can be used to further configure the cache.

Remarks

This method will override any previously set serialization methods.

This overload configures the System.Text.Json serializer with its default options. For information about the serializer's default behaivor, see JsonSerializerOptions properties.

This method is intended for easy configuration of the cache to use JSON serialization and is best suited for simple "POCO" types. For more complex types, or for types that require custom serialization behavior, you may need to provide a custom serializer or use attributes to control serialization behavior.

Note that the JSON serializer may not handle all types correctly, especially those with complex or circular references. By default, System.Text.Json will only serialize public properties. If your type has private fields or properties that need to be serialized, you may need to provide a custom converter or use attributes to control serialization behavior. See System.Text.Json docs for more information.

See Also