https://github.com/hejsil/cache
Provides caching for any command line tool that does not have it
https://github.com/hejsil/cache
cache cli zig
Last synced: about 1 year ago
JSON representation
Provides caching for any command line tool that does not have it
- Host: GitHub
- URL: https://github.com/hejsil/cache
- Owner: Hejsil
- License: mit
- Created: 2022-07-29T20:56:40.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-22T12:18:14.000Z (about 2 years ago)
- Last Synced: 2024-05-02T02:55:55.136Z (about 2 years ago)
- Topics: cache, cli, zig
- Language: Zig
- Homepage:
- Size: 33.2 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# cache
Can wrap any command line tool to provide caching for the output of that tool.
## Example
```sh
$ # We can use curl to get the weather data from wttr.in
$ curl -s 'https://wttr.in/'
...
$ # Caching this command is simple. It only depends on the arguments of the command,
$ # and outputs to stdout
$ cache -- curl -s 'https://wttr.in/'
...
$ # Now, this is cached and will never be invalidated (unless you delete
$ # ~/.cache/cache). We can specify that the command depends on external data. Let's
$ # have it depend on the output of `date`, so the cache is invalidated each day
$ cache -s "$(date +%Y-%m-%d)" -- curl -s 'https://wttr.in/'
...
$ # You can mark a command to depend on different things like environment variables
$ # (-e), files (-f) or even stdin (--stdin).
$ # cache can also handle if a command outputs to one or more files. You need to
$ # manually list the files the command will output
$ cache -o test -f test.c -- gcc -o test test.c
```