Cysharp / MemoryPack

Zero encoding extreme performance binary serializer for C# and Unity.
MIT License
3.22k stars 189 forks source link

How to Use Distributed Cache with SizeLimit in MemoryCache #330

Closed Amberg closed 1 week ago

Amberg commented 2 weeks ago

I set the “SizeLimit” in the memory cache and calculate the size when creating the cached objects.

If I have understood this correctly, the size is not saved in the Distributed Cache.

Therefore there is an exception when the item is loaded from the Distributed Cache into the MemoryCache because the size is then set to “-1”

The only workaround I can see at the moment is to set the size in the “FusionCacheEntryOptions” to an average value. But this makes limiting to a maximum memory consumption inaccurate, especially if the sizes of the individual objects vary greatly

Are there any other options?

Amberg commented 1 week ago

Wrong Repo. Sry 🙃