An application uses Azure Cache for Redis to store both temporary catalog search results and active shopping cart details. The transient catalog search results are configured with a defined Time-to-Live (TTL), while the shopping cart details are stored without a TTL. During periods of peak traffic, the cache memory becomes fully utilized. You must ensure that the Redis instance evicts the catalog search results based on a least-recently-used (LRU) algorithm when the memory limit is reached, while preserving all shopping cart details. In addition, you must reserve memory for replication and fragmentation overhead to prevent out-of-memory (OOM) conditions.
Which two configuration settings should you configure to meet these requirements?
- Set the maxmemory-policy configuration setting to volatile-lruCevap
- Configure a non-zero value for the maxmemory-reserved settingCevap
- CSet the maxmemory-policy configuration setting to allkeys-lru
- DSet the maxmemory-policy configuration setting to noeviction
- ESet the maxmemory-policy configuration setting to volatile-ttl
Cevap
Setting the maxmemory-policy configuration setting to volatile-lru and configuring a non-zero value for the maxmemory-reserved setting.
The correct configurations are setting the eviction policy to volatile-lru and configuring a non-zero value for the maxmemory-reserved setting. The volatile-lru policy ensures that under memory pressure, only keys with an active expiration (TTL) set are evaluated and evicted using a least-recently-used (LRU) algorithm, preserving keys without an expiration. Configuring the maxmemory-reserved setting allocates dedicated memory for replication and fragmentation overhead, preventing out-of-memory conditions on the instance.
Adım Adım Çözüm
Anahtar Kavram
Azure Cache for Redis eviction policies and memory reservation configuration.