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

[Feature Request] Per-function caching #332

Open
jbschooley opened this issue Oct 18, 2023 · 1 comment
Open

[Feature Request] Per-function caching #332

jbschooley opened this issue Oct 18, 2023 · 1 comment
Labels
feature-request New feature or request

Comments

@jbschooley
Copy link

I would love to see the ability to cache the result of an individual function in addition to an entire resolver.

For example, think of an app where you have 50 different endpoints. All of them do different things, but they all use the user's settings to determine what to do, like the user's chosen language or whether they have admin permissions. Hitting the data source for these same settings on every single query puts extra load on the database and adds latency.

Instead, you’d configure a function to grab these settings with ctx.identity as the cache key with a timeout of say 10 min. Then evict it on any request that changes a users settings or permission level.

@onlybakam onlybakam added the feature-request New feature or request label Nov 2, 2023
@jbschooley
Copy link
Author

Is this a feature that could be added? It would be incredibly useful for pretty much any resolver that uses db-based identity to determine what to return

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

No branches or pull requests

2 participants