Soru

Zorluk: OrtaImplement Azure Cache for Redis Configuration and Data Patterns

You manage an Azure Cache for Redis instance that stores session data and reference tables. The session keys are configured with an expiration time, while the reference tables must remain in the cache indefinitely and do not have an expiration time. Due to an unexpected surge in traffic, the cache is reaching its memory limit. You need to configure a policy that removes keys with an expiration time, prioritizing those closest to expiring, while ensuring the reference tables are not removed. Which maxmemory policy should you configure?

  1. A
    allkeys-lru
  2. volatile-ttlCevap
  3. C
    volatile-random
  4. D
    noeviction

Cevap

volatile-ttl
The volatile-ttl policy evicts keys with an expiration time (TTL) set, prioritizing those with the shortest remaining time-to-live. Since the reference tables do not have an expiration time, they are protected from eviction under this policy.

Adım Adım Çözüm

1
Analyze the requirements for key eviction.
Keys without an expiration time (reference tables) must not be evicted, while keys with an expiration time (session data) must be evicted.
This narrows the choice to policies prefixed with 'volatile-' because 'allkeys-' policies can evict any key regardless of whether it has an expiration time.
2
Determine the prioritization for evicting the keys with expiration times.
The requirement states that eviction should prioritize keys closest to expiring.
The 'volatile-ttl' policy specifically targets keys with an expiration time and evicts those with the shortest remaining time-to-live first.
3
Select the policy matching both criteria.
The correct policy is volatile-ttl.
It satisfies both the constraint of not evicting reference tables and prioritizing session keys closest to expiration.

Anahtar Kavram

Azure Cache for Redis maxmemory eviction policies
Bu soruyu puanla