Built CacheCore in C++ with Dynamic TTL Eviction

Built CacheCore — an in-memory key-value store in C++. One thing that bugged me was the TTL eviction thread was sleeping for a fixed 60 seconds between checks. It worked, but it felt wasteful. Since the next key to expire is always at the top of the min-heap, I switched it to calculate the exact sleep duration dynamically. Fewer wakeups, no unnecessary work. The rabbit holes are the best part of this kind of project. Debugging lock contention led me down into MESI cache coherence — how L1/L2 caches across cores stay consistent when threads are fighting over the same mutex. Didn't plan to go there. Curiosity just does that. What's inside: LRU via doubly linked list + unordered_map (O(1)), TTL via min-heap with lazy deletion, custom RESP protocol parser, stateless multi-DB routing. Benchmarked at 500K ops, ~6,260 ops/sec, p99 6.3ms, zero deadlocks. Repo: https://lnkd.in/gwsxQEHk If you've worked on storage engines or low-level concurrency, feedback is welcome. #cpp #systemsprogramming #backend #lowlevelprogramming

To view or add a comment, sign in

Explore content categories