Skip to content

Latest commit

 

History

History
161 lines (82 loc) · 2.15 KB

File metadata and controls

161 lines (82 loc) · 2.15 KB

🧠 PHASE 1 — Core In-Memory Store (Day 1–2) Core KV Engine

Implement in-memory Map

Implement SET key value

Implement GET key

Implement DEL key

Atomic execution (single event loop)

Internal Rules

Overwrite allowed

Null returned for missing keys

🎯 Goal: Functional KV engine

⏱️ PHASE 2 — TTL & Expiry Engine (Day 3–4)

Add per-key TTL metadata

Lazy expiration on GET

Active cleanup loop (interval)

Remove expired keys from store

Increment expired metrics

🎯 Goal: Keys expire correctly

♻️ PHASE 3 — LRU Eviction (Day 5–6)

Implement LRU cache (Map trick / DLL)

Promote key on GET

Evict least-recent key on overflow

Configurable max keys / memory

Track eviction count

🎯 Goal: Bounded memory system

💾 PHASE 4 — Persistence (Day 7–10) AOF (Append Only File)

Log SET / DEL / EXPIRE

Append-only writes

fsync strategy

Replay AOF on startup

Snapshot (RDB-like)

Periodic snapshot

Background snapshot

Serialize full store

Fast load on startup

Recovery

Load snapshot first

Replay AOF after snapshot

Ignore partial writes

🎯 Goal: Crash-safe durability

📣 PHASE 5 — Pub/Sub (Day 11)

Channel-based pub/sub

Multiple subscribers

Fan-out delivery

No persistence (ephemeral)

🎯 Goal: Real-time messaging

📊 PHASE 6 — Metrics & Observability (Day 12)

Hits / Misses

Expired keys

Evictions

AOF size

Snapshot duration

/metrics endpoint

🎯 Goal: Production visibility

⚙️ PHASE 7 — Configuration (Day 13)

Max memory

Eviction policy

Snapshot interval

AOF fsync mode

Environment-based config

🎯 Goal: Deployable system

🧪 PHASE 8 — Testing & Hardening (Day 14–15)

Manual crash tests

Restart recovery tests

TTL correctness tests

LRU correctness tests

Stress test (10k ops)

🎯 Goal: Not a toy anymore

📦 FINAL POLISH

Clean README

Architecture diagram

Design tradeoffs

Known limitations

Future roadmap