8000 Caching Extensions using Django Cache by hiporox · Pull Request #93 · strawberry-graphql/strawberry-django · GitHub
[go: up one dir, main page]

Skip to content

Caching Extensions using Django Cache #93

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

Merged
merged 17 commits into from
Apr 7, 2022

Conversation

hiporox
Copy link
@hiporox hiporox commented Feb 24, 2022

Implementations of Strawberry's ParserCache and ValidationCache, but using Django's cache instead of the functools.lru_cache

This is blocked by upgrading strawberry-graphql to >=0.98.0, since that will get us access to graphql-core@3.2.0, which fixes this issue graphql-python/graphql-core#112 which stops unpickling DocumentNode

@hiporox hiporox mentioned this pull request Feb 24, 2022
@bellini666
Copy link
Member

Hey @hiporox .

I can see how the validation extension being cached using django's cache would be useful, but I wonder in which scenario the parsing would would be? It seems to me that parsing should be faster than requesting an external resource for it (unless it is a very complicated query?)

@hiporox
Copy link
Author
hiporox commented Mar 7, 2022

@bellini666 I just copied over the functionality of the two types of caches that base strawberry already supports. It is very possible that the parsing cache will just be slower. I have not tested the speed of it in comparison to a regular query lookup. I am very happy to drop that chunk of the code and just leave the validation cache

@bellini666
Copy link
Member

@bellini666 I just copied over the functionality of the two types of caches that base strawberry already supports. It is very possible that the parsing cache will just be slower. I have not tested the speed of it in comparison to a regular query lookup. I am very happy to drop that chunk of the code and just leave the validation cache

Yeah, I think it is better to only have the validation cache here :)

@hiporox
Copy link
Author
hiporox commented Mar 15, 2022

@bellini666 Removed the parser cache and fixed the tests. How does it look now?

Copy link
Member
@bellini666 bellini666 left a comment

Choose a reason for hiding this comment

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

Just a few typing issues and it is good to merge! :)

@hiporox hiporox requested a review from bellini666 March 22, 2022 20:48
Copy link
Member
@bellini666 bellini666 left a comment

Choose a reason for hiding this comment

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

Just 2 minor details missing

Julian Early and others added 2 commits March 23, 2022 12:11
Co-authored-by: Thiago Bellini Ribeiro <hackedbellini@gmail.com>
Co-authored-by: Thiago Bellini Ribeiro <hackedbellini@gmail.com>
@hiporox hiporox requested a review from bellini666 March 23, 2022 19:11
@bellini666
Copy link
Member

@hiporox the PR is fine, just need to make the tests pass and I'll merge it!

@hiporox
Copy link
Author
hiporox commented Apr 6, 2022

@bellini666 Tests pass now, not sure what is up with precommit

@bellini666
Copy link
Member

Thanks for the contribution @hiporox :)

@bellini666 bellini666 merged commit ec00946 into strawberry-graphql:main Apr 7, 2022
@hiporox hiporox deleted the django_parse_cache branch April 7, 2022 17:14 < 6684 /div>
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
0