You configure an Azure Cache for Redis instance for an application. You want to ensure that no keys are ever automatically deleted when the cache reaches its memory limit, and that any write operations fail with an error instead.
Which two options describe the correct configuration parameter or behavior for this scenario?
- The maxmemory-policy configuration setting must be set to noeviction.Answer
- Write commands (such as SET or HSET) will return an error when the memory limit is reached.Answer
- CThe maxmemory-policy configuration setting must be set to volatile-lru to allow only keys without an expiration time to be evicted.
- DThe cache will automatically start evicting the least recently used keys across all keys in the cache regardless of expiration.
Answer
To prevent any key eviction under memory pressure and fail writes with an error, the maxmemory-policy must be set to noeviction, which causes write commands to return an out-of-memory error when the cache is full.
To prevent any data from being evicted from the cache under memory pressure, the maxmemory-policy must be set to noeviction. Under this policy, when the cache reaches its memory limit, any commands that attempt to write or add new data will fail and return an out-of-memory error to the application, while read-only requests continue to be served.
Step-by-Step Solution
Key Concept
Azure Cache for Redis Eviction Policies