README: add some extra detail and link to my introductory article
- ID
7857e2a- date
2026-11-16 07:41:30+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
f88f2f7- message
README: add some extra detail and link to my introductory article- changed files
1 file, 21 additions, 1 deletion
Changed files
README.md (1288 → 2072)
diff --git a/README.md b/README.md
index 3fbb8fd..8d3e6ef 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,8 @@
funkycache is a disk-backed cache for Python functions that tracks file dependencies.
I use it in my static site generator to cache the output of expensive functions.
-Example:
+To cache the output of a function, create a `FunkyCache` instance, then apply the `cache.register` decorator.
+For example:
```python
from funkycache import FunkyCache
@@ -32,6 +33,22 @@ If those dependent values change, the function's cache is invalidated, and the n
**Note:** funkycache does not watch the filesystem.
It is your responsibility to notify it of changes to dependent files, or they will be noticed when the Python process restarts.
+## Caching requirements
+
+To cache a function with funkycache, the function must:
+
+* Have a type hint with a return annotation
+* Always return an identical result when given identical inputs
+* Not have any side effects (for example, creating a file)
+
+## Design
+
+* Each function has an independent cache
+* Cache keys are the function arguments, serialised as JSON and hashed using XXH64
+* Cache values are the return value, serialised as JSON
+
+For more information about how funkycache works, read [my design notes][me-funkycache-intro].
+
## Installation
Install using pip:
@@ -43,3 +60,6 @@ $ pip install funkycache
## License
This project is shared under the [MIT license](./LICENSE).
+
+[me-funkycache-intro]: https://alexwlchan.net/2026/funkycache/
+[wiki-pure]: https://en.wikipedia.org/wiki/Pure_function