Module Omod_support.Cache

Omod cache.

type t

The type for cached information.

val v : pkgs:Pkg.db -> t

v ~pkgs is a cache with package database pkgs.

val pkgs : t -> Pkg.db

pkgs c is c's package database.

val file : Conf.t -> Omod.fpath

file conf is the cache file in configuration conf.

val read : Conf.t -> force:bool -> err:Log.t -> ( t option, string ) Stdlib.result

read conf is the cache of configuration conf (if any). If force is true and a cache read error occurs, it is logged on err and Ok None is returned.

val write : Conf.t -> t -> ( unit, string ) Stdlib.result

write conf c writes the cache c of configuration conf.

val clear : Conf.t -> ( unit, string ) Stdlib.result

clear conf clears the cache c of configuration conf.

val get : ?err:Log.t -> ?note:Log.t -> ?progress:bool -> Conf.t -> force:bool -> trust:bool -> ( t, string ) Stdlib.result

get ~err ~note ~progress conf ~force ~trust get the cache of configuration conf, forcing it if force is true and making sure it is fresh unless trust is true, using err to report errors, note to report indexing operations (defaults to Log.nil) and progress to indicate if progress should be reported on note (defaults to false).

val status : ?err:Log.t -> Conf.t -> t option -> Pkg.diff list

status ~err conf c is the status of cache c of configuration conf.

val codec : t Codec.t

codec is a codec for caches.