Module Tjr_lru_cache.Multithreaded_lru
Non-functorial multithreaded / concurrent-safe implementation of the LRU interface. This extends the in-memory explicit-state-passing code to the monad.
Compared to the in-mem version:
- we use the monad
- we allow multiple threads to call the interface methods
- for long-running operations (eg find, when the key is not in the i-m cache), we maintain a queue of blocked threads, make a single call to the lower layers, and when this returns we release the threads
- we have explicit messages to the lower layer
- the api includes "persist mode" (now or later) to indicate whether insert/delete operations should persist immediately or not
Given that the likely target is Lwt, this is probably overkill.
module type S = sig ... end
module Examples : sig ... end