From 2667ca263abf3e891fda58c00c8b5925ef74247d Mon Sep 17 00:00:00 2001 From: Michael Diamond Date: Sun, 2 Apr 2023 02:24:56 -0700 Subject: [PATCH] Cut 0.6.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 31 ++++++++++++++++++++++--------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8815396..dcb3230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,7 +34,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bkt" -version = "0.5.4" +version = "0.6.0" dependencies = [ "anyhow", "bincode", diff --git a/Cargo.toml b/Cargo.toml index 0630ead..e13888d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "bkt" # When updating the version number tag the commit in git # https://rust-lang.github.io/api-guidelines/documentation.html#release-notes-document-all-significant-changes-c-relnotes -version = "0.5.4" +version = "0.6.0" authors = ["Michael Diamond "] description = "CLI and Rust library for caching subprocess invocations" repository = "http://github.com/dimo414/bkt" diff --git a/README.md b/README.md index a79053c..777e430 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Package manager support is being tracked ## Usage ``` -bkt [--ttl=DURATION] [--stale=DURATION] [--cwd] [--env=ENV ...] [--scope=SCOPE] [--discard-failures] [--warm|--force] -- ... +bkt [--ttl=DURATION] [--stale=DURATION] [--cwd] [--env=ENV ...] [--modtime=FILE ...] [--scope=SCOPE] [--discard-failures] [--warm|--force] -- ... ``` The easiest way to use `bkt` is to simply prefix the command you intend to @@ -69,9 +69,9 @@ data is considered valid. The default TTL can be overriden by defining a When the data expires `bkt` has to re-execute the command synchronously, which can introduce unexpected slowness. To avoid this, pass `--stale` with a shorter -duration than the TTL. This causes `bkt` to refresh the cache in the background -when the cached data is older than the stale threshold while still returning -the old data promptly. +duration than the TTL. When the cached data is older than the stale threshold +this causes `bkt` to refresh the cache in the background while still promptly +returning the cached data. Both flags (and `BKT_TTL`) accept duration strings such as `10s` or `1hour 30min`. The exact syntax is defined in the @@ -81,7 +81,11 @@ library. ### Execution Environment Some commands' behavior depends on more than just the command line arguments. -It's possible to constrain the cache so that these invocations are not conflated. +It's possible to adjust how `bkt` caches such commands so that unrelated +invocations are cached separately. + +#### Working Directory + For example, attempting to cache `pwd` will not work as expected by default: ```shell @@ -108,10 +112,19 @@ $ bkt --cwd -- pwd /tmp/bar ``` -Similarly, to include one or more environment variables in the cache key pass -`--env`, such as `--env=TMPDIR` or `--env=LANG,TERM`. The flag can also be -passed multiple times. Invocations with different values for any of the given -variables will be cached separately. +#### Environment Variables + +Similarly, to specify one or more environment variables as relevant for the +command being cached use `--env`, such as `--env=LANG`. This flag can be +provided multiple times to key off additional variables. Invocations with +different values for any of the given variables will be cached separately. + +#### File Modifications + +It is also possible to have `bkt` check the last-modified time of one or more +files and include this in the cache key using `--modtime`. For instance passing +`--modtime=/etc/passwd` would cause the backing command to be re-executed any +time `/etc/passwd` is modified. ### Refreshing Manually