LRU Cache with TTL and Thread Safety

Published 2 October 2026

The initial task was to implement an LRU Cache.

The interviewer then added several enhancements, including:

  • Supporting TTL-based expiration
  • Making the implementation thread-safe
  • Extending the original cache behavior while preserving correctness