Cache_lib.Cached
val pure : 't -> ( 't, _ ) t
pure v
returns a pure cached object with * the value of v
. Pure cached objects are used * for unifying values with the Cached.t
type for * convenience. Pure cached objects are not stored * in a cache and cannot be consumed.
val is_pure : ( _, _ ) t -> bool
val original : ( _, 'b ) t -> 'b
val peek : ( 't, _ ) t -> 't
peek c
inspects the value of c
without consuming * c
.
val final_state : ( 't1, 't2 ) t -> 't2 Intf.final_state
val invalidate_with_failure : ( 't, _ ) t -> 't
invalidate c
removes the underlying cached value * of c
from its cache. invalidate
will return an * Error
if the underlying cached value was not * present in the cache.
val invalidate_with_success : ( 't, _ ) t -> 't
val was_consumed : ( _, _ ) t -> bool
transform c ~f ~logger
maps the value of c
over * f
, consuming c
.
val sequence_deferred :
( 't Async_kernel.Deferred.t, 'cache_t ) t ->
( 't, 'cache_t ) t Async_kernel.Deferred.t
sequence_deferred c
lifts a deferred value from * c
, returning a non deferred cached object in a * deferred context. c
is consumed.
val sequence_result :
( ( 't, 'e ) Core_kernel.Result.t, 'cache_t ) t ->
( ( 't, 'cache_t ) t, 'e ) Core_kernel.Result.t
sequence_result
lifts a result value from * c
, returning a result containing the raw * cached value if the value of c
was Ok
. * Otherwise, an Error
is returned and c
* is invalidated from the cache