-
-
Notifications
You must be signed in to change notification settings - Fork 438
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: cache validation rules #2603
Conversation
Hello @spawnia, do you have time to check this PR? |
Co-authored-by: Benedikt Franke <[email protected]>
# Conflicts: # CHANGELOG.md
Co-authored-by: Benedikt Franke <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @k0ka!
Released with https://github.com/nuwave/lighthouse/releases/tag/v6.45.0. |
resolves #2018
Changes
Added possibility to cache query validation successful result. So the 2nd time the query would appear, most validator won't run against it.
Notes:
hash
to\Nuwave\Lighthouse\Schema\AST\DocumentAST
ProvidesCacheableValidationRules
which extendsProvidesValidationRules
for backward compatibility. In the next release we might removeProvidesValidationRules
.Defer::executeDeferred
SubscriptionBroadcaster::broadcast
AsyncMutation::handle
Errors
might fail to serialize.lighthouse/src/GraphQL.php
Lines 393 to 397 in 0d8ea16
webonyx/graphql-php
, so there is no easy way to extend them and store hashes inside objects.I also added different benchmarks.
HugeRequestBench
creates requests with a lot of simple fragments: 1, 10 and 100 forbenchmark1
,benchmark10
andbenchmark100
respectively. Enabling validation cache improves execution time:benchmark1
from 4.222ms to 2.886msbenchmark10
from 14.984ms to 4.429msbenchmark100
from 189.641ms to 19.783ms