Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory cached Retained #33

Open
behrad opened this issue Jul 13, 2017 · 5 comments
Open

memory cached Retained #33

behrad opened this issue Jul 13, 2017 · 5 comments

Comments

@behrad
Copy link
Contributor

behrad commented Jul 13, 2017

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 ?

@mcollina
Copy link
Collaborator

Oh you mean caching all the retained messages like we do the tree of subscriptions?

@GavinDmello
Copy link
Collaborator

Would this be a fixed size cache?

@behrad
Copy link
Contributor Author

behrad commented Jul 13, 2017

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.

@mcollina
Copy link
Collaborator

@behrad how would you keep that cache updated?

@behrad
Copy link
Contributor Author

behrad commented Jul 13, 2017

on storeRetained the memory cache is also updated.

Let me create a simple PR to show this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants