Update README.md

This commit is contained in:
wassname (Michael J Clark)
2026-05-15 13:43:57 +08:00
committed by GitHub
parent 3bf7b51206
commit 3d90059274
+12 -9
View File
@@ -1,19 +1,22 @@
# minicache — tiny disk cache for ML / research code.
## minicache — tiny disk cache for ML / research code.
Wraps function calls and stores returns on disk (gzip + cloudpickle). Solves
This wraps function calls and stores returns on disk (gzip + cloudpickle). Solves
the four pain points that stdlib `functools.lru_cache + pickle` and existing
function-cache libraries (anycache, cachier) hit on ML code:
- **Loaded models can't be hashed** → arg blacklist (`exclude=["model", "tok"]`).
Excluded args pass through to the function but never enter the cache key.
- **Tensors / pandas / closures break stdlib pickle** → cloudpickle backend.
- **Pickle files grow large** → gzip on disk (~3× smaller, free).
- **"Function source changed → invalidate" causes false invalidations on
reformat** → caller bumps an explicit `state` string when behavior actually
changes. No AST hashing magic.
- *Loaded models can't be hashed*. So we use a arg blacklist (`exclude=["model", "tok"]`).
Here, excluded args pass through to the function but never enter the cache key.
- *Tensors / pandas / closures can't be picked** → we use cloudpickle which extends to many more objects.
- *Pickle files grow large* → gzip on disk save 20-50%
## Quick use
Install
```sh
uv add git+https://github.com/wassname/minicache.git
```
```py
from minicache import cached, cache_call