Complete the code to identify the main purpose of distributed caching.
Distributed caching is used to [1] data to reduce latency and load on the main database.
Distributed caching stores frequently accessed data to speed up access and reduce database load.
Complete the code to select the correct caching strategy.
In distributed caching, the [1] strategy ensures that data is updated in the cache when the database changes.
Write-through caching updates the cache immediately when the database is updated, keeping data consistent.
Fix the error in the cache invalidation approach.
To avoid stale data, the cache should be invalidated using [1] after the database update.Time-to-live (TTL) automatically expires cache entries after a set time, preventing stale data.
Fill both blanks to complete the cache key design and eviction policy.
Cache keys should be [1] to avoid collisions, and the eviction policy [2] removes least recently used items first.
Unique keys prevent collisions. LRU (Least Recently Used) eviction removes the oldest accessed items first.
Fill all three blanks to complete the distributed cache cluster setup.
The cache cluster uses [1] to distribute data, [2] to replicate data for fault tolerance, and [3] to monitor cluster health.
Consistent hashing distributes data evenly. Replication copies data for fault tolerance. Heartbeat checks cluster health.