Q19 Redis Domain 2 · 25–30% of exam

Which Redis command implements a cache-aside pattern by setting a value with an expiration time in one atomic operation?

  1. A SET key value
  2. B SETEX key seconds value
  3. C SET key value EX seconds
  4. D Both SETEX and SET with EX (correct answer)

Shortcut: Both SETEX key seconds value and SET key value EX seconds atomically set a value with an expiry. SET key value EX seconds is the modern preferred form supporting additional options.