Crate bkt[][src]

Expand description

bkt (pronounced “bucket”) is a library for caching subprocess executions. It enables reuse of expensive invocations across separate processes and supports synchronous and asynchronous refreshing, TTLs, and other functionality. bkt is also a standalone binary for use by shell scripts and other languages, see for binary details.

let bkt = bkt::Bkt::in_tmp()?;
let expensive_cmd = bkt::CommandDesc::new(&["wget", ""]);
let (result, age) = bkt.retrieve(&expensive_cmd, Duration::from_secs(3600))?;


This struct is the main API entry point for the bkt library, allowing callers to invoke and cache subprocesses for later reuse.

Describes a command to be executed and cached. This struct also serves as the cache key. It consists of a command line invocation and, optionally, a working directory to execute in and environment variables to set. When set these fields contribute to the cache key, therefore two invocations with different working directories set will be cached separately.

The outputs of a cached invocation of a CommandDesc, akin to std::process::Output.