Expiring Key-Value Cache with TTL
Asked at Meta · Coding Questions · Difficulty: Medium
Implement a key-value cache where each key carries a time-to-live. A key set at timestamp `t` with ttl `ttl` is valid while the query time is `< t + ttl` and expired once it is `>= t + ttl`.
Loading the problem…