Bird
0
0

A developer wants to migrate a REST API to GraphQL but is concerned about caching. What is a key difference in caching between REST and GraphQL?

hard📝 Application Q9 of 15
GraphQL - Basics and Philosophy
A developer wants to migrate a REST API to GraphQL but is concerned about caching. What is a key difference in caching between REST and GraphQL?
AGraphQL uses HTTP status codes for caching control.
BGraphQL responses are always cached automatically by browsers.
CREST does not support caching at all.
DREST responses can be cached by URL; GraphQL responses are harder to cache due to flexible queries.
Step-by-Step Solution
Solution:
  1. Step 1: Understand REST caching

    REST uses fixed URLs for resources, making caching straightforward via URL-based caches.
  2. Step 2: Understand GraphQL caching challenges

    GraphQL queries vary in shape and parameters, making caching by URL less effective and requiring more complex strategies.
  3. Final Answer:

    REST responses can be cached by URL; GraphQL responses are harder to cache due to flexible queries. -> Option D
  4. Quick Check:

    Caching difference = A [OK]
Quick Trick: REST caches by URL; GraphQL needs special caching due to query flexibility. [OK]
Common Mistakes:
  • Assuming GraphQL caching is automatic
  • Believing REST does not support caching

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes