package ringo-lwt

  1. Overview
  2. Docs

This is similar to CACHE_MAP except that it handles result. Specifically, you can insert ('a, 'b) result Lwt.t and promises that are fulfilled with Error _ are treated like promises that are rejected:

  • They are removed from the cache automatically.
  • They are not folded over by fold.

Parameters

Signature

type key = C.key
type ('a, 'err) t
val create : int -> ('a, 'err) t
val replace : ('a, 'err) t -> key -> ('a, 'err) result Lwt.t -> unit
val fold : (key -> 'a -> 'b -> 'b Lwt.t) -> ('a, 'err) t -> 'b -> 'b Lwt.t
val fold_promises : (key -> ('a, 'err) result Lwt.t -> 'b -> 'b) -> ('a, 'err) t -> 'b -> 'b
val find_opt : ('a, 'err) t -> key -> ('a, 'err) result Lwt.t option
val find_or_replace : ('a, 'err) t -> key -> (key -> ('a, 'err) result Lwt.t) -> ('a, 'err) result Lwt.t
val remove : ('a, 'err) t -> key -> unit
val length : ('a, 'err) t -> int
val capacity : ('a, 'err) t -> int
val clear : ('a, 'err) t -> unit
OCaml

Innovation. Community. Security.