This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,29 @@
module M_as_F (K: Hashtbl.HashedType) (V: Lru.Weighted):
Lru.F.S with type k = K.t and type v = V.t =
struct
let nope name _ =
invalid_arg @@ Format.sprintf "M_as_F.%s: not implemented" name
include Lru.M.Make (K) (V)
let unadd = nope "unadd"
let pop_lru = nope "pop_lru"
let empty n = create n
let find ?promote k t =
match find ?promote k t with Some v -> Some (v, t) | _ -> None
let retaining f t = f t; t
let trim = retaining trim
let resize cap = retaining @@ resize cap
let add ?trim k v = retaining @@ add ?trim k v
let remove k = retaining @@ remove k
let drop_lru = retaining drop_lru
let fold f s t = fold f s t
let iter f t = iter f t
let to_list t = to_list t
end