https://github.com/bennn/with-cache
Simple, filesystem-based caching for Racket
https://github.com/bennn/with-cache
Last synced: 2 months ago
JSON representation
Simple, filesystem-based caching for Racket
- Host: GitHub
- URL: https://github.com/bennn/with-cache
- Owner: bennn
- License: other
- Created: 2016-08-04T03:46:24.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-06-28T15:00:24.000Z (almost 3 years ago)
- Last Synced: 2025-01-30T11:42:34.975Z (4 months ago)
- Language: Racket
- Size: 43.9 KB
- Stars: 17
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-racket-and-scheme - with-cache - based caching for Racket (Racket / Tools/lib)
README
with-cache
===
[](https://travis-ci.org/bennn/with-cache)
[](https://coveralls.io/github/bennn/with-cache?branch=master)
[](http://docs.racket-lang.org/with-cache/index.html)Simple, filesystem-based caching.
0. Pick a directory to store caches in.
By default, it's the `./compiled/with-cache` directory.
1. Wrap "expensive" computations in a thunk, call the thunk via `with-cache`.
2. Results of the expensive computation are automatically stored and retrieved.Example:
```
(with-cache "fact42.rktd"
(λ () (factorial 42)))
(with-cache "pict.rktd"
(λ () (standard-fish 100 50))
#:read deserialize
#:write serialize)
```Install
---From the Racket [package server](pkgs.racket-lang.org):
```
$ raco pkg install with-cache
```From Github:
```
$ git clone https://github.com/bennn/with-cache
$ raco pkg install ./with-cache
```Don't forget the `./`!
More
---The real documentation is here:
http://docs.racket-lang.org/with-cache/index.htmland has instructions for:
- invalidating cachefiles
- changing the default cache directory
- cachefile naming conventions