package plebeia

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Node hashconsing based on the hashes

It actually provides an on-memory cache map from Hash.t to Index.t

type _ t

The cache table type

type config = {
  1. 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

    *)
  2. threshold_absolute : int;
    (*

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

    *)
  3. shrink_ratio : float;
    (*

    How much data we keep for each wipe.

    *)
}
type stat = {
  1. ever_hit : int;
  2. 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.

OCaml

Innovation. Community. Security.