package ringo-lwt

  1. Overview
  2. Docs

This is similar to CACHE_MAP except that it handles option. Specifically, you can insert 'a option Lwt.t and promises that are fulfilled with None are treated like promises that are rejected:

  • They are removed from the cache automatically.
  • They are not folded over by fold.
type key
type 'a t
val create : int -> 'a t
val replace : 'a t -> key -> 'a option Lwt.t -> unit
val fold : (key -> 'a -> 'b -> 'b Lwt.t) -> 'a t -> 'b -> 'b Lwt.t
val fold_promises : (key -> 'a option Lwt.t -> 'b -> 'b) -> 'a t -> 'b -> 'b
val find_opt : 'a t -> key -> 'a option Lwt.t option
val find_or_replace : 'a t -> key -> (key -> 'a option Lwt.t) -> 'a option Lwt.t
val remove : 'a t -> key -> unit
val length : 'a t -> int
val capacity : 'a t -> int
val clear : 'a t -> unit