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

feat(response-cache): support @cacheControl(scope: CacheControlScope) #1884

Merged
merged 3 commits into from
Jul 3, 2023

Conversation

EmrysMyrddin
Copy link
Collaborator

@EmrysMyrddin EmrysMyrddin commented Jun 16, 2023

Description

Adds support for the scope argument of the Apollo's @cacheControl directive.

The goal is to make @cacheControl behaviour as close as possible from Apollo's one to make schema using it easily working in Yoga.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Waiting for feat(response-cache): support @cacheControl(maxAge: Int) #1603

Further comments

I have also provided a way to use this feature using the configuration object passed to the plugin.
I have only added a perSchemaCoordinate way of configuration as I think having both a perType and perCoordinate is a bit redundant since coordinate can represent a type instead of a field.

@changeset-bot
Copy link

changeset-bot bot commented Jun 16, 2023

🦋 Changeset detected

Latest commit: 22b0e27

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@envelop/response-cache Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@EmrysMyrddin EmrysMyrddin changed the base branch from main to cacheControl-directive June 16, 2023 20:05
@github-actions
Copy link
Contributor

github-actions bot commented Jun 16, 2023

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@envelop/response-cache 5.1.0-alpha-20230619210318-22b0e271 npm ↗︎ unpkg ↗︎
@envelop/response-cache-redis 3.1.0-alpha-20230619210318-22b0e271 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Jun 16, 2023

💻 Website Preview

The latest changes are available as preview in: https://1aec7069.envelop.pages.dev

@theguild-bot
Copy link
Collaborator

theguild-bot commented Jun 16, 2023

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.............................................: 100.00% ✓ 625008      ✗ 0     
     data_received......................................: 2.4 GB  16 MB/s
     data_sent..........................................: 136 MB  905 kB/s
     envelop_total......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:prom-tracing }............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     event_loop_lag.....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:prom-tracing }............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_blocked...................................: avg=1.94µs  min=600ns    med=1.1µs   max=12.01ms p(90)=1.7µs   p(95)=2µs    
     http_req_connecting................................: avg=138ns   min=0s       med=0s      max=6.36ms  p(90)=0s      p(95)=0s     
     http_req_duration..................................: avg=4.48ms  min=180.9µs  med=3.33ms  max=73.97ms p(90)=9.25ms  p(95)=15.7ms 
       { expected_response:true }.......................: avg=4.48ms  min=180.9µs  med=3.33ms  max=73.97ms p(90)=9.25ms  p(95)=15.7ms 
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=3.94ms  min=389.29µs med=3.52ms  max=33.01ms p(90)=6.32ms  p(95)=7.64ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=2.31ms  min=180.9µs  med=1.69ms  max=27.45ms p(90)=4.27ms  p(95)=7.8ms  
     ✓ { mode:envelop-just-cache }......................: avg=3.97ms  min=389.4µs  med=3.47ms  max=30.87ms p(90)=6.55ms  p(95)=7.82ms 
     ✓ { mode:graphql-js }..............................: avg=6.61ms  min=648.29µs med=5.63ms  max=57.67ms p(90)=10.95ms p(95)=12.4ms 
     ✓ { mode:prom-tracing }............................: avg=18.56ms min=3.16ms   med=16.58ms max=73.97ms p(90)=32.39ms p(95)=33.35ms
     http_req_failed....................................: 0.00%   ✓ 0           ✗ 312504
     http_req_receiving.................................: avg=42.72µs min=10.9µs   med=18µs    max=17.32ms p(90)=26.2µs  p(95)=32.9µs 
     http_req_sending...................................: avg=30.24µs min=4.2µs    med=6.5µs   max=26.27ms p(90)=12µs    p(95)=17.1µs 
     http_req_tls_handshaking...........................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...................................: avg=4.41ms  min=155.9µs  med=3.27ms  max=73.92ms p(90)=8.96ms  p(95)=15.64ms
     http_reqs..........................................: 312504  2082.928985/s
     iteration_duration.................................: avg=4.79ms  min=375.7µs  med=3.65ms  max=74.24ms p(90)=9.9ms   p(95)=16.01ms
     iterations.........................................: 312504  2082.928985/s
     vus................................................: 10      min=10        max=20  
     vus_max............................................: 20      min=20        max=20  

@EmrysMyrddin EmrysMyrddin changed the title feat(response-cache): support @cacheControl(maxAge: Int) feat(response-cache): support @cacheControl(scope: CacheControlScope) Jun 16, 2023
Base automatically changed from cacheControl-directive to main June 19, 2023 20:52
@EmrysMyrddin EmrysMyrddin merged commit 5817474 into main Jul 3, 2023
19 checks passed
@EmrysMyrddin EmrysMyrddin deleted the feature/response-cache-scope branch July 3, 2023 12:35
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.

3 participants