Module Tjr_lru_cache

A multithreaded LRU cache (part of ImpFS; safe to open)

include Tjr_lru_cache__.Summary
module Lru_entry = Im_intf.Lru_entry

NOTE module renamed from Entry

type 'v lru_entry = 'v Lru_entry.lru_entry
module Mt_intf : sig ... end

Main mt (multithreaded lru) types; don't open outside this lib

module Lru_msg = Mt_intf.Lru_msg
type ('k, 'v, 't) lru_msg = ('k'v't) Lru_msg.lru_msg
module Lru_factory = Mt_intf.Lru_factory
type ('k, 'v, 'lru, 't) lru_factory = ('k'v'lru't) Lru_factory.lru_factory
module Mt_ops = Mt_intf.Mt_ops
include Mt_ops
type ('k, 'v, 't) mt_ops = {
mt_find : 'k -> ('v option't) Tjr_monad.m;
mt_insert : 'k -> 'v -> (unit, 't) Tjr_monad.m;
mt_delete : 'k -> (unit, 't) Tjr_monad.m;
mt_sync_key : 'k -> (unit, 't) Tjr_monad.m;
mt_sync_all_keys : unit -> (unit, 't) Tjr_monad.m;
}

The interface provided by the multithreaded LRU; provides blocking/non-blocking operations, and persist now/persist later flags.

These are the operations supported by the LRU.

NOTE this interface doesn't allow "transaction" operations (multiple ops, which commit atomically). This is sufficient for ImpFS - the kv store is pointwise syncable not transactional. However, since the lower level does support transactional operations, it seems strange to limit the functionality here.

NOTE all calls are blocking; for non-blocking calls, launch an async light-weight thread.

module Multithreaded_lru : sig ... end

Non-functorial multithreaded / concurrent-safe implementation of the LRU interface. This extends the in-memory explicit-state-passing code to the monad.

module Lru_examples = Multithreaded_lru.Examples