PracHub
QuestionsLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Bytedance

Add TTL to an LRU cache

Last updated: Apr 16, 2026

Quick Overview

This question evaluates a candidate's understanding of cache design, LRU eviction policies, time-to-live (TTL) semantics, appropriate data structures, time complexity reasoning, and concurrency control.

  • hard
  • Bytedance
  • Software Engineering Fundamentals
  • Software Engineer

Add TTL to an LRU cache

Company: Bytedance

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Onsite

Design an in-memory LRU cache and explain how to extend it with TTL support. Requirements: - `get(key)` returns the value if the key exists and has not expired; otherwise it returns a cache miss. - `put(key, value, ttl)` inserts or updates an entry with an expiration time. - When capacity is exceeded, evict the least recently used item. - Expired items should never be returned, and the design should explain how they are removed. - Discuss the data structures, time complexity, cleanup strategy, and concurrency considerations.

Quick Answer: This question evaluates a candidate's understanding of cache design, LRU eviction policies, time-to-live (TTL) semantics, appropriate data structures, time complexity reasoning, and concurrency control.

Related Interview Questions

  • Debug and Extend a Priority-Aware Python Thread Pool - Bytedance (easy)
  • Handle Island Counting When the Grid Does Not Fit in Memory - Bytedance (hard)
  • Backend Fundamentals Deep Dive: MySQL Internals, Redis, and the HTTP/HTTPS Request Lifecycle - Bytedance (hard)
  • Prepare for an SRE Systems Fundamentals Round - Bytedance (easy)
  • Explain Backend Infrastructure Fundamentals - Bytedance (medium)
|Home/Software Engineering Fundamentals/Bytedance

Add TTL to an LRU cache

Bytedance logo
Bytedance
Mar 10, 2026, 12:00 AM
hardSoftware EngineerOnsiteSoftware Engineering Fundamentals
3
0

Design an in-memory LRU cache and explain how to extend it with TTL support.

Requirements:

  • get(key) returns the value if the key exists and has not expired; otherwise it returns a cache miss.
  • put(key, value, ttl) inserts or updates an entry with an expiration time.
  • When capacity is exceeded, evict the least recently used item.
  • Expired items should never be returned, and the design should explain how they are removed.
  • Discuss the data structures, time complexity, cleanup strategy, and concurrency considerations.
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Bytedance•More Software Engineer•Bytedance Software Engineer•Bytedance Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.