package tezos-protocol-011-PtHangz2

  1. Overview
  2. Docs
Module type
Class type

An INTERFACE to the subcache where keys live in a given namespace.

type cached_value

The type of value to be stored in the cache.

val update : context -> identifier -> (cached_value * size) option -> (context, Tezos_protocol_environment_011_PtHangz2__Environment.Error_monad.error Tezos_protocol_environment_011_PtHangz2__Environment.Error_monad.trace) result

update ctxt i (Some (e, size)) returns a context where the value e of given size is associated to identifier i in the subcache. If i is already in the subcache, the cache entry is updated.

update ctxt i None removes i from the subcache.

val find : context -> identifier -> (cached_value option, Tezos_protocol_environment_011_PtHangz2__Environment.Error_monad.error Tezos_protocol_environment_011_PtHangz2__Environment.Error_monad.trace) result Lwt.t

find ctxt i = Some v if v is the value associated to i in the subcache. Returns None if there is no such value in the subcache. This function is in the Lwt monad because if the value may have not been constructed (see the lazy loading mode in Environment_context), it is constructed on the fly.

val list_identifiers : context -> (string * int) list

list_identifiers ctxt returns the list of the identifiers of the cached values along with their respective size. The returned list is sorted in terms of their age in the cache, the oldest coming first.

val identifier_rank : context -> string -> int option

identifier_rank ctxt identifier returns the number of cached value older than the one of identifier; or, None if the identifier has no associated value in the subcache.

val size : context -> int

size ctxt returns an overapproximation of the subcache size (in bytes).

val size_limit : context -> int

size_limit ctxt returns the maximal size of the subcache (in bytes).


Innovation. Community. Security.