Timed Cache with Expiration and OOM Eviction

Implement an in-memory TimedCache with TTL expiration.

The cache supports:

  • set(key, value, ttl): write or update key at the current time. Its expiration time is current_time + ttl.
  • `get(...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: