TTL-Aware LRU Cache for Security Master Lookups

Last updated: November 29, 2026

Quick Overview

Implement a bounded in-process cache for security reference data lookups that evicts the least recently used entry when full and treats entries older than a TTL as misses, with O(1) get and put.

Point72
Software Engineering Fundamentals
Software Engineer
Point72
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Implement a bounded in-process cache for security reference data lookups that evicts the least recently used entry when full and treats entries older than a TTL as misses, with O(1) get and put.

Research and trading services at Point72 hit the security master constantly to map tickers to identifiers, sectors, and lot sizes, and that data changes on corporate actions. The interviewer is looking at memory bounds, data structure choice for O(1) operations, and whether you think about staleness and testability (an injectable clock) rather than only the happy path.

What the Interviewer Expects
  • Choose a hash map plus recency order (OrderedDict or dict plus doubly linked list)
  • Bound memory by entry count and explain how to bound by bytes instead
  • Expire lazily on read and prefer evicting expired entries when full
  • Inject the clock so TTL behaviour is testable without sleeping
  • Expose hit, miss, and eviction counters for tuning
Key Topics to Cover
LRU cache
TTL expiry
memory bounds
OrderedDict
cache stampede
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you make this safe for many threads, and would you shard the lock?
  • How do you avoid a stampede when a hot ticker expires and 200 requests miss at once?
  • How would you invalidate entries when a corporate action event arrives instead of waiting for the TTL?
  • When is an LFU or a size-aware policy better than LRU here?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

get(key) returns the value if present and fresh, otherwise a default. put(key, value) inserts or refreshes. At most capacity entries. Each entry expires ttl seconds after its last put. Both op...

High-Level Design

An OrderedDict gives a hash lookup and a recency list in one structure: move_to_end on a hit, popitem(last=False) for the LRU. Each value stores its expiry time. Expiry is lazy: a read that find...


Submit Your Answer
Markdown supported