Understanding Cache Expiry
Which cache expiry strategy automatically removes data after a certain period?
- Time-based expiration
- Manual invallidation
- Read-through cache
- Write-aside cache
- Pinning cache
Manual Invalidation Explained
In a system where administrators explicitly remove items from cache when data is updated, which strategy is being used?
- Manual invalidation
- Timer-expired caching
- Lazy evction
- Cache warming
- Automatic eviction
Stale Cache Scenario
What issue arises if cached data is not updated when the underlying database changes?
- Stale data problem
- Cache miss storm
- Thrashing
- Hot spot
- Negative caching
Time-To-Live Usage
Given cache.set('user', userData, ttl=60), which best describes the effect of ttl=60?
- The cached value expires after 60 seconds
- The cache auto-refreshes every 60 seconds
- Only 60 cache entries are allowed
- User data will be refreshed every minute
- The cache is invalidated upon user logout
Write-Through Strategy
Which strategy updates the cache and the underlying database at the same time when a write operation occurs?
- Write-through caching
- Write-buhind caching
- Cache warming
- Read-through caching
- Cache pinning
Problem with Lazy Expiry
Why can lazy expiration (checking expiry only upon access) lead to problems?
- Stale data may remain if cache entries are not accessed
- It causes constant cache eviction
- It increases database writes
- It disables cache prefetching
- It results in redundant invalidation
Cache Consistency Level
Which term describes ensuring that all users see the most up-to-date data, even if cached copies exist?
- Strong consistency
- Eventual consistancy
- Weak consitency
- Cache warming
- Cache hydration
Invalidation by Event
When is cache event-based invalidation most effective?
- When changes to the underlying data can be detected in real time
- When the cache is only read occasionally
- If cache entries never expire
- When cache warming is used
- When there's only one user
Cache Stampede
What is a 'cache stampede' and how can it be prevented?
- When many clients simultaneously try to refresh an expired cache entry; prevent with locking
- When cache size exceeds memory limit; prevent by manual invalidation
- When cache entries are never reused; prevent with stronger consistency
- When only one client updates cache; prevent with write-around caching
- When database is not updated; prevent by cache-only reads
Choosing Expiry Strategies
Which factor should NOT influence your choice of cache expiry strategy?
- The color scheme of your website
- How frequently underlying data changes
- Consistency requirements
- Performance goals
- Data freshness needs