Bird
0
0

How can you combine Last-Modified with ETag headers to improve cache validation in a REST API?

hard📝 Application Q9 of 15
Rest API - Caching Strategies
How can you combine Last-Modified with ETag headers to improve cache validation in a REST API?
ASend both headers but never check If-None-Match or If-Modified-Since.
BUse only Last-Modified and ignore ETag headers.
CUse ETag as a replacement for Last-Modified date format.
DUse Last-Modified for date checks and ETag for content hash validation.
Step-by-Step Solution
Solution:
  1. Step 1: Understand header roles

    Last-Modified provides a timestamp, ETag provides a unique content identifier (hash).
  2. Step 2: Combine for better validation

    Clients can use If-Modified-Since and If-None-Match to validate cache more precisely.
  3. Final Answer:

    Use Last-Modified for date checks and ETag for content hash validation. -> Option D
  4. Quick Check:

    Last-Modified + ETag = stronger cache validation [OK]
Quick Trick: Combine Last-Modified date and ETag hash for caching [OK]
Common Mistakes:
MISTAKES
  • Ignoring ETag when Last-Modified exists
  • Using ETag as date format
  • Not checking conditional headers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes