-
Notifications
You must be signed in to change notification settings - Fork 167
Description
Problem
I’m using this amazing library to manage both combined (in-memory and distributed) caches and distributed-only caches.
Some of these caches hold millions of entries, accessed concurrently by dozens of app nodes (following a producer/consumer pattern). Thanks to a new feature introduced in recent versions of the library, we can now use distributed-only caches, which has spared us from having nodes consume massive amounts of memory unnecessarily.
So far, so good, but KeyDB is also consuming a lot of memory, and we aim to reduce its usage as well.
The issue is that FusionCache stores a lot of metadata in Redis, which is essentially useless since Redis already handles expiration, and the in-memory part of the cache is disabled.
For example, to simply store the string value "var", we get something like this:
127.0.0.1:6379> HGETALL "v0:foo"
- "absexp"
- "638710876575684414"
- "data"
- "{"$id":"1","v":"bar","m":{"$id":"2","e":"2024-12-29T16:47:37.5660416+00:00"},"t":638684956575645632}"
- "sldexp"
- "-1"
That's quite too much memory overhead when the caches have millions of entries.
Solution
Add a cache-level (or entry-level option) to control, at the distributed level, if the value should be serialized/deserialized as usual or simply stored/retrieved in its raw form.
127.0.0.1:6379> GET "foo"
"bar"