ZiggyCreatures / FusionCache

FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features.
MIT License
1.9k stars 97 forks source link

[FEATURE] Can MemeryPack supprot BrotliCompressor? #302

Closed brotherhorse closed 2 months ago

jodydonetti commented 2 months ago

Hi @brotherhorse , yes MemoryPack supports Brotli compression, see here.

I think you can mark your classes with some attributes and it should work.

Hope this helps, let me know if it worked.

brotherhorse commented 2 months ago

How to set BrotliCompressor(var compress)?

MyCode: _fusionCache = new FusionCache( new FusionCacheOptions { DefaultEntryOptions = new FusionCacheEntryOptions(TimeSpan.FromSeconds(absoluteExpiration)) }); var compress = new BrotliCompressor(); var options = new MemoryPackSerializerOptions(); var serializer = new FusionCacheCysharpMemoryPackSerializer(options); //add DistributedCach
_fusionCache.SetupDistributedCache(ocs.DistributedCache, serializer); //add Backplane _fusionCache.SetupBackplane(ocs.Create(_channel));

brotherhorse commented 2 months ago

@jodydonetti

jodydonetti commented 2 months ago

Yeah @brotherhorse I saw it, but it was 2am here in Italy and I have a daily job. Will get back to you as soon as I can.

jodydonetti commented 2 months ago

Btw, have you tried this:

I think you can mark your classes with some attributes and it should work.

?

jodydonetti commented 2 months ago

Hi, I've had some time to look at this. It seems like currently it's not possible to use the BrotliCompressor directly.

Separately I'm working on compression in general, not just Brotli for MemoryPack, but it will need some more time, so don't wait for it soon.

I may have a temporary solution for you, but I need a little bit more time.

brotherhorse commented 2 months ago

Sorry to disturb your rest. Thank you very much for your reply. As Redis requires compressed storage to save space, I can temporarily use CompressLZ4. Thank you again.

jodydonetti commented 2 months ago

Sorry to disturb your rest.

No disturb at all! It's just that I was not able to answer earlier 🙂

Thank you very much for your reply. As Redis requires compressed storage to save space, I can temporarily use CompressLZ4. Thank you again.

You're welcome, I'll update you in the future when compression may become a native, full-fledged feature of FusionCache.

Best.