The Scenario
Your app displays live stock prices fetched from an external API. The external API takes 2 seconds to respond and limits you to 100 requests per minute. Your app receives 500 requests per minute.
The Brief
Implement a caching layer using Redis. If a stock price was fetched in the last 15 seconds, serve it from Redis. Otherwise, fetch it from the external API, save it to Redis with an expiration (TTL), and return it.
Deliverables
- The caching middleware/service code using a Redis client
- An explanation of how TTL (Time To Live) prevents stale data
- What happens if the Redis server crashes? Explain your fallback strategy.
Submission Guidance
A good cache implementation should be invisible to the end user (except that it is much faster). Make sure you handle cache misses correctly.
Submit Your Work
Your submission is graded against the rubric on the right. If you pass, you get a public Badge URL you can share on LinkedIn. There is no draft save, so work offline first and paste your finished response here.