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

Is there a support for client-side-caching? #1623

Open
arielorvits opened this issue Jun 27, 2021 · 9 comments
Open

Is there a support for client-side-caching? #1623

arielorvits opened this issue Jun 27, 2021 · 9 comments
Labels

Comments

@arielorvits
Copy link

https://redis.io/topics/client-side-caching

@leibale
Copy link
Contributor

leibale commented Jun 28, 2021

We plan to add support for this in v4.1

@tnabil
Copy link

tnabil commented Aug 7, 2022

Hi, assuming this didn't make it into v4.1? Is it planned for an upcoming release?

@leibale
Copy link
Contributor

leibale commented Aug 8, 2022

@tnabil It's on the roadmap, but it'll take some time. I hope I'll have time this week to share the roadmap.

@hansott
Copy link

hansott commented Oct 27, 2022

@leibale This will have a tremendous impact on a lot of applications. Currently, there's no easy way to do avoid server lookups if the data is already available in the running Node.js process. It's really easy to make mistakes when trying to achieve static caching. The only safe way is using a per request static cache but even this is hard to implement. In languages like PHP it's relatively easy to use static caching. Just some thoughts. Of course, it's not going to be easy to implement this in the client (I guess).

@hansott
Copy link

hansott commented Jan 25, 2023

@leibale Any update? 😇

@leibale
Copy link
Contributor

leibale commented Jan 25, 2023

@hansott we want to get to it, but there are a couple of features with higher priority (for example, Sentinel and RESP3) 😐
If somebody wants to work on this feature, please ping me and I'll try to help..

@hansott
Copy link

hansott commented Jan 25, 2023

@leibale I might take a stab at it when I find some time. Can you share some thoughts how to approach this one? Is there any chat we can use?

@leibale
Copy link
Contributor

leibale commented Jan 25, 2023

The Redis discord server is probably the easiest way (search for "leibale" and DM me), or if you don't have discord we can use this issue as a chat...

Some thoughts:

  1. Because RESP3 is not yet implemented (in the client), you'll have to use the "two connections mode", so you'll have to create another client and redirect all the invalidate messages to it (this should be done by the package, not the "user").
  2. The replies cache is just a map from the command arguments to the JS reply (not the RESP reply).
  3. There should be another map that maps a key to the cached replies, so once the server invalidates a key, you'll be able to find and remove all the cached replies for this key.
  4. In #sendCommand if there is a reply for the command in the cache, make sure to use structuredClone before returning it.

@xf86cfg
Copy link

xf86cfg commented Nov 22, 2023

Is there any update on it?

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

No branches or pull requests

5 participants