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?
- Avolatile-lru
- Bnoeviction
- allkeys-lruAnswer
- Dvolatile-ttl
Answer
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.
Step-by-Step Solution
Key Concept
Azure Cache for Redis Eviction Policies