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 a cache on /metadata #5189

Merged
merged 8 commits into from
Apr 26, 2024
Merged

Add a cache on /metadata #5189

merged 8 commits into from
Apr 26, 2024

Conversation

lucasbordeau
Copy link
Contributor

In this PR I'm introducing a simple custom graphql-yoga plugin to create a caching mechanism specific to our metadata.

The cache key is made of : workspace id + workspace cache version, with this the cache is automatically invalidated each time a change is made on the workspace metadata.

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, much better thank you @lucasbordeau! 👏

@Weiko Weiko merged commit 77eece7 into main Apr 26, 2024
3 of 4 checks passed
@Weiko Weiko deleted the feat/optimize-metadata-request branch April 26, 2024 15:31
Weiko added a commit that referenced this pull request Apr 26, 2024
## Context
@lucasbordeau introduced a new Yoga plugin that allows us to cache our
requests (👏), see #5189
I'm simply updating the implementation to allow us to use different
cache storage types such as redis
Also adding a check so it does not use cache for other operations than
ObjectMetadataItems

## Test
locally, first call takes 340ms, 2nd takes 30ms with 'redis' and 13ms
with 'memory'
arnavsaxena17 pushed a commit to arnavsaxena17/twenty that referenced this pull request Oct 6, 2024
In this PR I'm introducing a simple custom graphql-yoga plugin to create
a caching mechanism specific to our metadata.

The cache key is made of : workspace id + workspace cache version, with
this the cache is automatically invalidated each time a change is made
on the workspace metadata.
arnavsaxena17 pushed a commit to arnavsaxena17/twenty that referenced this pull request Oct 6, 2024
## Context
@lucasbordeau introduced a new Yoga plugin that allows us to cache our
requests (👏), see twentyhq#5189
I'm simply updating the implementation to allow us to use different
cache storage types such as redis
Also adding a check so it does not use cache for other operations than
ObjectMetadataItems

## Test
locally, first call takes 340ms, 2nd takes 30ms with 'redis' and 13ms
with 'memory'
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

Successfully merging this pull request may close these issues.

2 participants