Exercises

Redis-Backed Caching Patterns and Invalidation

Explore practical caching techniques used in backend systems with Redis. This quiz assesses cache-aside, write-through and write-behind patterns, TTL behavior, eviction policies, key design, negative caching, invalidation across services, hot-key mitigation, and safe distributed locking. Questions range from foundational concepts to production scenarios involving stale data, cache stampedes, and consistency trade-offs.

Answer the questions below and check the explanation for each answer.

0/17 answered

  1. 1

    The diagram shows an application checking Redis, reading from the database after a miss, and then storing the result in Redis. Which caching pattern is shown?

    Question 1
  2. 2

    What is the primary purpose of assigning a TTL to a cached value?

  3. 3

    Which cache key best prevents user 42's profile data from colliding with other resource types?

  4. 4

    The timeline shows a key stored at 12:00:00 with a 60-second TTL. What should a lookup at 12:01:05 normally produce if the key was not refreshed?

    Question 4
  5. 5

    Why might a backend add random jitter to cache expiration times?

  6. 6

    A full LRU cache contains A, B, and C. The diagram shows A was used least recently. Which key should be evicted when D is inserted?

    Question 6
  7. 7

    What does negative caching store?

  8. 8

    The diagram shows hundreds of requests missing the same expired key and querying the database at once. What problem is occurring?

    Question 8
  9. 9

    Which technique allows one request to regenerate a missing value while other requests wait or reuse stale data?

  10. 10

    Which Redis operation is most appropriate as the basis for acquiring a simple expiring per-key lock?

  11. 11

    The diagram shows one service publishing a product-update event that causes every application instance to remove its local cached copy. Which strategy is illustrated?

    Question 11
  12. 12

    When an application updates a database record under the cache-aside pattern, which action most directly reduces stale reads?

  13. 13

    What is a key trade-off of write-through caching?

  14. 14

    The diagram shows an application writing to a cache immediately while a queue persists the change to the database later. Which pattern is shown?

    Question 14
  15. 15

    Why is caching a paginated query using only the key products:list unsafe when filters and page numbers vary?

  16. 16

    The diagram shows a very large share of traffic targeting one key on a single Redis shard. What operational risk does this represent?

    Question 16
  17. 17

    How should a backend safely release a Redis lock that was created with a unique ownership token?

Video Courses

Courses related to this topic

See all video courses

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate