Ocamlnet 3 Reference Manual : Uq_engines.cache_t

# Class type Uq_engines.cache_t

    class type ['a] cache_t = object .. end

A cache contains a mutable value that is obtained by running an engine.

    method get_engine : unit -> 'a engine

Requests the value. If it is not already in the cache, the engine for getting the value is started, and it is waited until the value is available.

    method get_opt : unit -> 'a option

Returns the cached value if available

    method put : 'a -> unit

Puts a value immediately into the cache. It replaces an existing value. If it is currently tried to obtain a new value by running an engine, this engine is kept running, and `get_engine` will return its result. Only future calls of `get_engine` will return the value just put into the cache.

    method invalidate : unit -> unit

Invalidates the cache - if a value exists in the cache, it is removed. If in the future the cache value is requested via `get_engine` the engine will be started anew to get the value.

Note that (as for `put`) any already running `get_engine` is not interrupted.

    method abort : unit -> unit

Any engine running to get the cache value is aborted, and the contents of the cache are invalidated. Note that also the engines returned by `get_engine` are aborted.