package hc

  1. Overview
  2. Docs

Module type Hc.CacheSource

The type of custom cache modules.

Sourcetype key

The type of keys.

Sourcetype !'a t

The type of caches with 'a values.

Sourceval create : int -> 'a t

create n creates a new, empty cache, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the cache. The cache must grow as needed, so n is just an initial guess.

Sourceval clear : 'a t -> unit

Empty a cache.

Sourceval add : 'a t -> key -> 'a -> unit

add cache key v adds a binding of key to v in cache cache.

Sourceval find : 'a t -> key -> 'a

find cache v returns the current binding of v in cache, or must raise Not_found if v is not in cache.

Sourceval length : 'a t -> int

length cache returns the number of bindings in cache.

Sourceval stats : 'a t -> Hashtbl.statistics

stats cache return statistics about the cache cache.

OCaml

Innovation. Community. Security.