← Questions
Blocking cache where reads wait for a missing key
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Build a keyed cache whose get(key) returns at once when the key is present and otherwise blocks until some thread puts that key. put(key, value) stores or replaces the value and wakes every reader waiting on that key, in the order they started waiting, each seeing the value just put. Implement it with per-key waiting (not one global wake-up), then discuss timeouts on get and what happens to waiters if a key is never written.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
