dotnetcore / EasyCaching

:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
MIT License
1.92k stars 321 forks source link

DiskCache supports custom serializers #450

Closed Memoyu closed 1 year ago

Memoyu commented 1 year ago

Content

Then use diskcache to allow custom serializers. Currently, the following serializers are supported:

  1. NewtonsoftJson
  2. SystemTextJson
  3. Message Pack

Usage:

option.UseDisk(cfg =>
{
    cfg.DBConfig = new DiskDbOptions { BasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Cache") };
    cfg.SerializerName = "msgpack";
}, "disk")
.WithJson("json")
.WithSystemTextJson("sysjson")
.WithMessagePack("msgpack");