Soru

Zorluk: KolayImplement Azure Cache for Redis Configuration and Data Patterns

A web application stores user shopping cart data in an Azure Cache for Redis instance. The application does not specify an expiration time (Time to Live) for the cache keys. You need to configure the cache to automatically evict the least recently used keys across the entire dataset when memory limit is reached. Which maxmemory eviction policy should you configure?

  1. A
    volatile-lru
  2. B
    noeviction
  3. allkeys-lruCevap
  4. D
    volatile-ttl

Cevap

Configure the cache with the allkeys-lru eviction policy.
The correct policy is allkeys-lru. This policy evicts the least recently used keys from the entire key space, which is required because the application does not set an expiration time (TTL) on the keys. Choosing a volatile policy would fail to evict any keys without TTL.

Adım Adım Çözüm

1
Analyze the requirements for cache eviction under memory pressure.
The keys in the cache do not have a Time to Live (TTL) set, and the goal is to evict the least recently used (LRU) keys across all keys when the memory limit is reached.
This helps identify whether we need a policy targeting volatile keys (those with TTL) or all keys.
2
Evaluate the difference between volatile and allkeys policies.
Volatile policies only evict keys that have an expiration time set, while allkeys policies evaluate all keys in the database.
Since the cache keys do not have a TTL set, using a volatile policy would result in no keys being evicted, causing the cache to run out of memory.
3
Select the correct LRU policy.
The allkeys-lru policy is the correct choice because it evicts the least recently used keys among the entire dataset, ignoring whether a TTL is set.
This matches all configuration constraints of the scenario.

Anahtar Kavram

Azure Cache for Redis Eviction Policies
Bu soruyu puanla