Expand description
Binary cache for parsed ledgers.
This module provides a caching layer that can dramatically speed up subsequent loads of unchanged beancount files by serializing the parsed directives to a binary format using rkyv.
§How it works
- When loading a file, compute a hash of all source files
- Check if a cache file exists with a matching hash
- If yes, deserialize and return immediately (typically <1ms)
- If no, parse normally, serialize to cache, and return
§Cache location
Cache files are stored alongside the main ledger file with a .cache extension.
For example, ledger.beancount would have cache at ledger.beancount.cache.
Structs§
- Archived
Cache Entry - An archived
CacheEntry - Archived
Cached Options - An archived
CachedOptions - Archived
Cached Plugin - An archived
CachedPlugin - Cache
Entry - Complete cache entry containing all data needed to restore a
LoadResult. - Cache
Entry Resolver - The resolver for an archived
CacheEntry - Cached
Options - Cached options - a serializable subset of Options.
- Cached
Options Resolver - The resolver for an archived
CachedOptions - Cached
Plugin - Cached plugin information.
- Cached
Plugin Resolver - The resolver for an archived
CachedPlugin
Functions§
- invalidate_
cache - Invalidate the cache for a file.
- load_
cache_ entry - Try to load a cache entry from disk.
- reintern_
directives - Re-intern all strings in directives to deduplicate memory.
- save_
cache_ entry - Save a cache entry to disk.