Smart Caching Decisions Quiz: What, When, and How to Invalidate Quiz

  1. Choosing Cache Candidates

    Which type of data is generally the BEST candidate for caching?

    1. Frequently accessed and rarely changing data
    2. Highly dynamic stock price feeds
    3. User passwords
    4. Sensitive authentication tokens
    5. Single-use access codes
  2. Invalidation Strategy

    If a cached user's profile is updated, what is the most appropriate cache invalidation action?

    1. Remove only the cached entry for that user
    2. Purge the entire cache
    3. Extend the cache's expiration time
    4. Do nothing and rely on natural expiry
    5. Invalidate all caches related to the application
  3. Cache-Aside Pattern

    In the cache-aside pattern, what happens when a cache miss occurs?

    1. Data is loaded from the database and put in the cache
    2. An error is thrown to the client
    3. The cache is purged
    4. Nothing happens; empty data is returned
    5. All cached data is refreshed
  4. Stale Data Scenario

    Suppose a product's price changes. You are using a cache with a 10-minute TTL. When would it be MOST appropriate to invalidate the cache for that product?

    1. Immediately after updating the price in the database
    2. Exactly after 10 minutes have passed
    3. Only when the cache is queried next
    4. Every hour automatically
    5. Never invalidate; just let the TTL expire
  5. Cache Consistency

    Which technique helps maintain cache consistency with the underlying data store?

    1. Write-through caching
    2. Increasing cache size
    3. Adding random delays to cache updates
    4. Enhancing log verbosity
    5. Ignoring update operations
  6. Identifying Overcaching

    Which of the following is a symptom of overcaching?

    1. Users see outdated information frequently
    2. Database load increases significantly
    3. Application response time decreases
    4. Less memory is used on the cache server
    5. Cache hit ratio is extremely low
  7. Scenario: Expiring Login Session

    If login sessions are cached and can be revoked at any time, what is the best invalidation approach?

    1. Explicitly delete the session from the cache upon revocation
    2. Rely solely on automatic TTL expiration
    3. Extend session lifetime whenever accessed
    4. Invalidate all sessions whenever any session is revoked
    5. Cache sessions permanently
  8. Cache Key Design

    Which is the best practice when designing cache keys for user-specific data?

    1. Include the user's ID in the cache key
    2. Use only the data type as the cache key
    3. Use a static key for all users
    4. Do not use cache keys
    5. Randomize the cache key on each request
  9. Lazy vs. Eager Invalidation

    Which statement correctly describes lazy cache invalidation?

    1. Cached data is invalidated only when the data is next requested
    2. All cached data is invalidated at regular scheduled intervals
    3. Cached data is immediately invalidated upon any update
    4. Cached data is never invalidated
    5. The cache size is decreased on invalidation
  10. Cache and Critical Real-Time Data

    Why is it generally a bad idea to cache real-time sensor data?

    1. Real-time data changes too quickly to remain accurate if cached
    2. Caching real-time data always provides fresher results
    3. Caches cannot be used for any kind of data
    4. Caches automatically update themselves in real-time
    5. Caching uses more CPU than direct data access