Skip to main content

Module cache

Module cache 

Source
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

  1. When loading a file, compute a hash of all source files
  2. Check if a cache file exists with a matching hash
  3. If yes, deserialize and return immediately (typically <1ms)
  4. 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§

ArchivedCacheEntry
An archived CacheEntry
ArchivedCachedOptions
An archived CachedOptions
ArchivedCachedPlugin
An archived CachedPlugin
CacheEntry
Complete cache entry containing all data needed to restore a LoadResult.
CacheEntryResolver
The resolver for an archived CacheEntry
CachedOptions
Cached options - a serializable subset of Options.
CachedOptionsResolver
The resolver for an archived CachedOptions
CachedPlugin
Cached plugin information.
CachedPluginResolver
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.