package knights_tour

  1. Overview
  2. Docs

Module Knights_tour.CacheSource

Disk-based memoization utility for expensive computations. Uses Marshal for serialization and a hash function for cache keys.

Sourceval default_cache_dir : string
Sourceval ensure_cache_dir_exists : string -> unit
Sourceval memoize : ?cache_dir:string -> function_name:string -> hash:('a -> string) -> ('a -> 'b) -> 'a -> 'b

memoize ~cache_dir ~hash f returns a memoized version of f.

  • hash is a function from input to string (used as filename).
  • cache_dir is the directory to store cache files (default: /tmp/ocaml_cache).
  • f is the expensive function to memoize.