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 https://github.com/dimo414/bkt for binary details.
let bkt = bkt::Bkt::in_tmp()?;
let expensive_cmd = bkt::CommandDesc::new(&["wget", "http://example.com"]);
let (result, age) = bkt.execute(&expensive_cmd, Duration::from_secs(3600))?;
do_something(result.stdout_utf8());
Structs
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
.