aedes-persistence-redis
aedes-persistence-redis copied to clipboard
memory cached `Retained`
What about a caching option to cache the retained
hash key inside memory @mcollina ?
This way createRetainedStream
won't touch redis on each CONNECT, I believe this really improves on a crowded environment. What dya think @GavinDmello ?
Oh you mean caching all the retained messages like we do the tree of subscriptions?
Would this be a fixed size cache?
Oh you mean caching all the retained messages like we do the tree of subscriptions?
yea, in the simplest form all the hash can be inside an javascript object, so instead of HGETing retained
key, we iterate over Object.keys(retainedCache)
. We simply sync the catch with redis retained key on writes. However this could be handled inside aedes-cached-persistence
to work on all persistences.
Would this be a fixed size cache?
We can use a Bounded list, or even warn the user to turn off caching in a retained heavy environment.
@behrad how would you keep that cache updated?
on storeRetained
the memory cache is also updated.
Let me create a simple PR to show this...