Table of Contents

Method SetSerialization

Namespace
Scaleout.Client
Assembly
Scaleout.Client.dll

SetSerialization(Action<TValue, Stream>, Func<Stream, TValue>)

Sets the callbacks used to perform serialization/deserialization of objects in the cache.

public CacheBuilder<TKey, TValue> SetSerialization(Action<TValue, Stream> serializer, Func<Stream, TValue> deserializer)

Parameters

serializer Action<TValue, Stream>

An Action<T1, T2> method used to serialize the provided object into the provided stream. Do not close the stream supplied to this callback.

deserializer Func<Stream, TValue>

A Func<T, TResult> function that deserializes and returns an object from the provided stream. Do not close the stream supplied to this callback.

Returns

CacheBuilder<TKey, TValue>

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

See Also

SetSerialization(Func<TValue, Stream, int>, Func<Stream, (TValue, int)>)

Sets the callbacks used to perform serialization/deserialization of objects in the cache. The methods return a user-defined memory usage estimate (in bytes) to improve the accuracy of memory usage in the in-process client cache.

public CacheBuilder<TKey, TValue> SetSerialization(Func<TValue, Stream, int> serializer, Func<Stream, (TValue, int)> deserializer)

Parameters

serializer Func<TValue, Stream, int>

A function used to serialize the provided object into the provided stream, returning the estimated, instantiated size of the object prior to serialization.

deserializer Func<Stream, (TValue, int)>

A Func<T, TResult> function that deserializes and returns the object and its estimated memory usage.

Returns

CacheBuilder<TKey, TValue>

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

See Also