Bird
0
0

Given this HTTP response header:

medium📝 Predict Output Q4 of 15
Rest API - Caching Strategies
Given this HTTP response header:
Cache-Control: max-age=5
If a client requests the same resource 7 seconds later, what will happen?
AThe client will use the cached response without contacting the server
BThe client will revalidate the cache with the server before using it
CThe client will receive an error due to expired cache
DThe client will ignore the cache and request a fresh response from the server
Step-by-Step Solution
Solution:
  1. Step 1: Understand max-age meaning

    max-age=5 means cache is fresh for 5 seconds after response.
  2. Step 2: Analyze client request after 7 seconds

    After 7 seconds, cache is expired, so client must request fresh data.
  3. Final Answer:

    The client will ignore the cache and request a fresh response from the server -> Option D
  4. Quick Check:

    Cache expired after max-age seconds = fresh request [OK]
Quick Trick: Cache expires after max-age seconds, then client fetches fresh data [OK]
Common Mistakes:
MISTAKES
  • Assuming cache is still valid after max-age
  • Confusing revalidation with expiration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes