plebeia

Functional storage using Merkle Patricia tree
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library plebeia
Module Plebeia . Node_cache
type _ t

The cache table type

type config = {
threshold_at_shrink : int;(*

Call of shrink triggers the wipe of unpopular data when the number of the items in the table exceeds this amount

*)
threshold_absolute : int;(*

Call of add triggers the wipe of unpopular data when the number of the items in the table exceeds this amount

*)
shrink_ratio : float;(*

How much data we keep for each wipe.

*)
}
type stat = {
ever_hit : int;
ever_added : int;
}
val config_enabled : config
val config_disabled : config
val get_stat : _ t -> stat
val create : config -> _ t

Create a new empty table with the shrink_size. May raise Invalid_arg

val pp_stat : Stdlib.Format.formatter -> _ t -> unit

Print out the stat

val find_opt : 'a t -> Hash.t -> 'a option
val add : 'a t -> Hash.t -> 'a -> unit
val size : _ t -> int

The number of the entries in the table.

val estimated_size_in_bytes : _ t -> int

Estimated table size in bytes.

This is for 28 byte Hash.t and 32 byte Index.t, where each element costs about 142 bytes.

It returns 99-101% of the real size.

val shrink : _ t -> unit

Shrink down the size of the table lower than threshold_commit.