bkt

bkt (pronounced "bucket") is a subprocess caching utility written in Rust.

github - releases - crates.io - docs.rs

$ bkt --help

CLI and Rust library for caching subprocess invocations


Usage: bkt [OPTIONS] --ttl <DURATION> -- <COMMAND>...


Arguments:

  <COMMAND>...  The command to run


Options:

      --ttl <DURATION>    Duration the cached result will be valid for [env: BKT_TTL=] [aliases:

                          time-to-live]

      --stale <DURATION>  Duration after which the result will be asynchronously refreshed

      --warm              Asynchronously execute and cache the given command, even if it's already cached

      --force             Execute and cache the given command, even if it's already cached

      --cwd               Includes the current working directory in the cache key, so that the same command

                          run in different directories caches separately [aliases: use-working-dir]

      --env <NAME>        Includes the given environment variable in the cache key, so that the same command

                          run with different values for the given variables caches separately [aliases:

                          use-environment]

      --modtime <FILE>    Includes the last modification time of the given file(s) in the cache key, so that

                          the same command run with different modtimes for the given files caches separately

                          [aliases: use-file-modtime]

      --discard-failures  Don't cache invocations that fail (non-zero exit code). USE CAUTION when passing

                          this flag, as unexpected failures can lead to a spike in invocations which can

                          exacerbate ongoing issues, effectively a DDoS

      --scope <NAME>      If set, all cached data will be scoped to this value, preventing collisions with

                          commands cached with different scopes [env: BKT_SCOPE=]

      --cache-dir <DIR>   The directory under which to persist cached invocations; defaults to the system's

                          temp directory. Setting this to a directory backed by RAM or an SSD, such as a

                          tmpfs partition, will significantly reduce caching overhead [env: BKT_CACHE_DIR=]

  -h, --help              Print help

  -V, --version           Print version