aliexpressru / memcached

A high-performance client library for managing multiple instances of Memcached, optimized for scalability and reliability. This library is designed to provide seamless integration and efficient caching solutions for large-scale applications, ensuring low latency and high throughput. Developed and maintained by AliExpress CIS.
https://www.nuget.org/packages/Aerx.Memcached.Client
MIT License
27 stars 1 forks source link

Made BinaryConverter's serializer options configurable by client #6

Closed winter3angle closed 1 year ago

winter3angle commented 1 year ago

BinaryConverter's serializer options are statically initialized and it may not be desired in some cases. For example, MultiStore will throw if data to be cached is some sort of recursive structure. Configurable serializer would allow to workaround such corner cases.

abarbolin commented 1 year ago

I added a configurator that you can call and change serializer:

BinaryConverterConfigurator.SetSerializer(JsonSerializer.Create(new JsonSerializerSettings
        {
            Converters = new List<JsonConverter>(new[] { new StringEnumConverter() }),
            NullValueHandling = NullValueHandling.Ignore,
            ContractResolver = new DefaultContractResolver
            {
                NamingStrategy = new SnakeCaseNamingStrategy()
            }
        }));