Build Your Own Cache
Build Your Own Cache in TypeScript: put(), get(), LRU eviction and TTL expiry. About 50–150 lines of readable, educational code with a live playground.
put(), get(), LRU eviction and TTL expiry.
Related
- Cache: Hits, Misses, TTL & Invalidation — Simulation
- Caching Lab — Lab
Other builds
- Build a Consistent Hash Ring — Virtual nodes and minimal key movement when servers change.
- Build a Mini Message Broker — Topics, partitions, offsets and consumer groups in ~100 lines.
- Build a Retry Mechanism — Exponential backoff with jitter and a retry budget.
- Build a Circuit Breaker — Closed, open and half-open states with a failure threshold.
- Build a Simple Event Bus — Publish/subscribe with isolated subscriber failures.
- Build a Repository — A collection-like interface backed by an in-memory store.
- Build a Unit of Work — Track new, dirty and removed objects; commit them together.
- Build a Simple CQRS System — Commands update a write model; events project read models.