Skip to content

Describes the apollo server cache issue with an example

Notifications You must be signed in to change notification settings

shreyas1496/apollo-cache-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apollo-cache-issue

Describes the apollo server cache issue with an example.

Instructions

  • Clone this repository
  • npm install
  • Start the gql server node index.js
  • From another terminal window, run curl 'http://localhost:4000/' -H 'Connection: keep-alive' -H 'content-type: application/json' --data-raw '{"operationName":null,"variables":{},"query":"{\n hello\n}\n"}' --compressed {"data":{"hello":"world"}} to execute the query
  • OBSERVE THE TIME TAKEN TO FULFILL THE API REQUEST ON THE CONSOLE
  • The first request takes ~ 700 ms to complete. The subsequent requests take around ~ 0.100 ms to complete. This is a huge gap.
  • You can try multiple combinations cache configurations. Results follow a similar pattern
  • Rerun the server after uncommenting the this.memoizedResults.clear(); under random-user-datasource.js

Screenshots/ Results

  • Screenshot from 2021-05-25 11-13-43
  • When the memosized results are clear (Expected result)
  • Screenshot from 2021-05-25 11-13-49

About

Describes the apollo server cache issue with an example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published