Module Tjr_lib_core.Lru_with_slow_operations

Interfaces

type ('k, 'v) op = [
| `Insert of 'k * 'v
| `Delete of 'k
]
type 'v op' = [
| `Insert of 'v
| `Delete
]
module Bot : sig ... end

Lowest level (bottom) operations, typically those supported by a persistent on-disk log.

module Top : sig ... end

Top-level operations.

Implementation

type 'v entry' = 'v option * bool Stdlib.ref
type ('v, 't) entry =
| Plain of 'v entry'

the ref is "dirty" flag

| Finding of ('v option't) Tjr_monad.m
val lower_none : unit -> 'a option * bool Stdlib.ref
val lower_some : 'a -> 'a option * bool Stdlib.ref
val insert : 'a -> 'a option * bool Stdlib.ref
val delete : unit -> 'a option * bool Stdlib.ref
type ('k, 'v, 'lru, 't) cache_state = {
mutable is_syncing : bool;
mutable syncing : (unit, 't) Tjr_monad.m;

If we are syncing, then we service operations we can immediately, and other operations wait for the sync. This field is only meaningful if is_syncing is true.

lru : 'lru;

Lru state is mutable

trim_delta : int;

Number of entries we trim each time the cache gets too big; trim_delta should be much less than cap

lru_capacity : int;

LRU capacity

}
module type S = sig ... end
module type T = sig ... end
module Make : functor (S : S) -> T with type k = S.k and type v = S.v and type lru = S.lru

Functor make

val make : bot_ops:('k'v'bot, Tjr_monad.lwt) Bot.ops -> bot:'bot -> (module T with type k = 'k and type v = 'v)

make as a function.

NOTE: This uses Stdlib pervasive equality and hashing on values of type k; this provides a simpler interface where the Lru functionality is constructed for the user

module Test : functor () sig ... end