package regular

  1. Overview
  2. Docs

Data digesting for caching.

include Core_kernel.Std.Identifiable with type t = digest
type t = digest
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
val of_string : string -> t
val to_string : t -> string
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t
val clamp : t -> min:t -> max:t -> t Core_kernel.Or_error.t
module Replace_polymorphic_compare : sig ... end
type comparator_witness
val validate_lbound : min:t Core_kernel.Maybe_bound.t -> t Core_kernel.Validate.check
val validate_ubound : max:t Core_kernel.Maybe_bound.t -> t Core_kernel.Validate.check
val validate_bound : min:t Core_kernel.Maybe_bound.t -> max:t Core_kernel.Maybe_bound.t -> t Core_kernel.Validate.check
val comparator : (t, comparator_witness) Core_kernel.Comparator.comparator
module Map : sig ... end
module Set : sig ... end
val hash : t -> int
val hashable : t Core_kernel.Hashable.Hashtbl.Hashable.t
module Table : sig ... end
module Hash_set : sig ... end
module Hash_queue : sig ... end
val pp : Format.formatter -> t -> unit
val create : namespace:string -> t

create ~namespace create a digest initialized with the given namespace. Since a caching service is using a flat namespace of keys, the namespace parameter is used to distinguish data build by different functions that have the same parameters digests. A module name is a good candidate for the namespace.

val add : t -> ('a, Format.formatter, unit, t) Core_kernel.Std.format4 -> 'a

add digest fmt x y z ... is a variadic function that builds a string from arguments x y z ... using specified format fmt and adds this string to the digest.

val add_sexp : t -> ('a -> Core_kernel.Std.Sexp.t) -> 'a -> t

add_sexp d sexp_of x is add d "%a" Sexp.pp (sexp_of x)