Skip to main content

Module cache

Module cache 

Source
Expand description

Content-addressed cache of pandoc JSON ASTs.

Obtain-AST dominates cost. After the first successful parse of a given (format, source) pair, reuse JSON from:

  1. Process-local memory (hash → Arc)
  2. Disk under $SNAPPER_PANDOC_CACHE_DIR or $XDG_CACHE_HOME/snapper/pandoc-ast (disable with SNAPPER_PANDOC_CACHE=0)

Keys are SHA-256 over format \\0 input. Values are raw pandoc JSON bytes. This is the practical speed lever for CLI re-runs and multi-file batches without changing the AST→region model.

Functions§

cache_key
Stable key for (format, input).
clear_memory
Clear process-local memory cache (tests / benchmarks).
get_json
Look up cached pandoc JSON for (format, input).
put_json
Store pandoc JSON for (format, input) in memory and on disk.