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

Add user-specific hash to cacheKey #3586

Closed
firatoezcan opened this issue Feb 9, 2022 · 1 comment
Closed

Add user-specific hash to cacheKey #3586

firatoezcan opened this issue Feb 9, 2022 · 1 comment

Comments

@firatoezcan
Copy link

Is your feature request related to a problem? Please describe.
Right now it's impossible to cache authenticated data which for some web-apps is most of it, especially considering some fields cannot even be queried for some backend permissions.
Obviously an easy solution would be to only cache fields that are the same for every user (anon/non-anon) but this get's pretty rough to maintain and is a non-solution when the whole app is user-specific. Instead it would be nice to add some user-specific data to the cacheKey and (somehow) group them together with the cacheKey that currently exists.

This obviously makes the cache bigger, but that's just something that happens with any caching strategy involving user data

Describe the solution you'd like

I'd like it if the cacheKey had some mechanic that allowed it to store different versions of the same "base"-cacheKey depending on given data. For now I see most of the benefits by including the header only, but this could be some special function that gets declared in the .meshrc.yaml in the future

Describe alternatives you've considered

Additional context

Implementing this makes the cache plugins more difficult since they would need to be able to invalidate f.e. the product.price field for every user. I know this can be done with HSET and HDEL but it would be more work.

@theguild-bot theguild-bot mentioned this issue Aug 11, 2022
@ardatan
Copy link
Owner

ardatan commented Mar 31, 2023

It is possible to add user specific details to the cache key now in the response caching plugin.
See;
https://the-guild.dev/graphql/mesh/docs/plugins/response-caching#getting-started
Let us know if this doesn't work.
Closing the issue for now.

@ardatan ardatan closed this as completed Mar 31, 2023
@theguild-bot theguild-bot mentioned this issue Sep 28, 2023
This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants