README: start writing a more detailed description
- ID
d3fa9fa- date
2026-11-07 08:15:24+00:00- author
Alex Chan <alexc@tailscale.com>- parent
11d6b1c- message
README: start writing a more detailed description- changed files
1 file, 31 additions, 1 deletion
Changed files
README.md (90 → 1138)
diff --git a/README.md b/README.md
index 5b54869..c444604 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,33 @@
# funkycache
-funkycache is a SQLite-backed function cache that tracks file dependencies.
+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:
+
+```python
+from funkycache import FunkyCache
+
+cache = FunkyCache(storage="sqlite")
+
+
+@cache.register(files=["content/index.md", "templates/base.html"])
+def render_index() -> str:
+ page = Path("content/index.md").read_text()
+ template = Path("templates/base.html").read_text()
+ return template.replace("{{ content }}", page)
+
+
+print(render_index()) # runs the function
+print(render_index()) # cache hit, even in a new process
+
+cache.notify_path_change("content/index.md")
+
+print(render_index()) # runs the function again
+```
+
+When you register a function with funkycache, you can declare path or static values the function depends on.
+If those dependent values change, the function's cache is invalidated, and the next call will rerun the function fresh.
+
+**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.