Bird
0
0

You want to design a cache invalidation system combining TTL and event-driven invalidation for a REST API with frequent updates. Which approach is optimal?

hard📝 Application Q8 of 15
Rest API - Caching Strategies
You want to design a cache invalidation system combining TTL and event-driven invalidation for a REST API with frequent updates. Which approach is optimal?
ARely solely on TTL to simplify cache management
BUse event-driven invalidation for critical updates and TTL as a fallback for stale data
CInvalidate cache only on server restarts
DUse manual invalidation exclusively without TTL
Step-by-Step Solution
Solution:
  1. Step 1: Understand hybrid strategies

    Combining TTL and event-driven invalidation leverages strengths of both: immediate invalidation and safety net for stale data.
  2. Step 2: Evaluate options

    Use event-driven invalidation for critical updates and TTL as a fallback for stale data uses event-driven invalidation for timely updates and TTL to prevent stale cache if events are missed.
  3. Final Answer:

    Use event-driven invalidation for critical updates and TTL as a fallback for stale data -> Option B
  4. Quick Check:

    Hybrid uses event-driven plus TTL fallback [OK]
Quick Trick: Combine event-driven with TTL fallback for freshness [OK]
Common Mistakes:
MISTAKES
  • Using only TTL causes stale data delays
  • Ignoring TTL risks stale cache if events fail
  • Invalidating only on server restart is inefficient

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes