Courseiva

PCDE Practice Question: Manage a solution that can span multiple database technologies

A game development company wants to use Memorystore for Redis as a session store. They need to ensure that when memory is full, the least recently used keys are evicted first. Which eviction policy should they configure?

⚠ Common exam trap

A common pitfall in Redis eviction policies is confusing 'volatile-lru' (only keys with TTL) with 'allkeys-lru' (all keys). Since the company needs to evict the least recently used keys regardless of expiry, 'allkeys-lru' is correct.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

allkeys-lru

(allkeys-lru) is correct because the requirement is to evict the least recently used keys from the entire keyspace when memory is full. The 'allkeys-lru' policy applies the LRU algorithm to all keys, regardless of whether they have an expiry set, which matches the need to evict the least recently used keys first across the entire dataset.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • volatile-lru

    Why it's wrong here

    This evicts only keys with an expiry set, not all keys. The requirement is to evict any key based on LRU.

  • allkeys-lru

    Why this is correct

    This evicts the least recently used keys from the entire keyspace, which matches the requirement.

  • volatile-ttl

    Why it's wrong here

    This evicts keys with the shortest TTL, not necessarily the least recently used.

  • noeviction

    Why it's wrong here

    This does not evict any keys; writes will fail when memory is full.

About these practice questions

One of 1,446 original PCDE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on PCDE

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You have a Memorystore for Redis instance that serves as a session store for a web application. The instance is running low on memory and is approaching the maxmemory limit. You want to ensure that the least recently used keys are evicted first when memory is full. Which eviction policy should you configure?

medium
  • A.allkeys-lru
  • B.noeviction
  • C.volatile-lru
  • D.volatile-ttl

Why C: The volatile-lru policy evicts keys with an expire set (TTL) using the LRU algorithm. For a session store, sessions typically have a TTL, so volatile-lru is appropriate. allkeys-lru would evict any key regardless of TTL, which might remove important keys. noeviction would cause write errors when memory is full. volatile-ttl evicts based on TTL, not LRU.

Variation 2. You manage a Memorystore for Redis instance that is regularly hitting its maximum memory limit. The application can tolerate some data loss and prefers to keep the most recently used data. Which eviction policy should you configure?

medium
  • A.noeviction
  • B.volatile-lru
  • C.volatile-ttl
  • D.allkeys-lru

Why B: volatile-lru evicts keys with an expiry set (volatile keys) using an LRU (least recently used) algorithm. This fits the requirement: the application can tolerate loss of expired data, and it prefers to keep recently used data. allkeys-lru would evict any key, which might include important unexpired keys.

Variation 3. An organization is using Memorystore for Redis and needs to ensure that when memory usage reaches the maximum, the cache evicts keys based on the least recently used (LRU) algorithm among keys with an expiry set. They also want to require password authentication for client connections. Which two configurations should be applied? (Choose TWO.)

medium
  • A.Configure the AUTH password in the Memorystore instance
  • B.Set maxmemory-policy to 'allkeys-lru'
  • C.Enable TLS for encryption
  • D.Set maxmemory-policy to 'volatile-lru'
  • E.Enable persistence with AOF

Why A: The eviction policy 'volatile-lru' evicts keys with an expiry set using LRU. AUTH is configured by setting a password via the Redis AUTH command or in the Memorystore instance settings.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCDE exam.