Data file cache limits: schema changes ignored
0 reputation · 16 Oct 2025, 15:14 UTC
Goal
Understand how Hugo’s data file cache behaves when the schema of a data file changes without a file-modification timestamp change, and whether this limitation can be addressed.
Constraints
Hugo caches parsed YAML, JSON, and TOML files in resources/_gen. The cache key is built from the file path and its last-modified timestamp. If the internal structure of the data changes but the timestamp remains unchanged, Hugo may continue to serve the stale cached representation, causing templates to render outdated data.
Unresolved questions
- What are the exact cache invalidation rules for data files in Hugo 0.112.0 and later?
- Is there a configuration option or build flag that would make Hugo detect schema changes in data files and automatically invalidate the cache?
- What would be the performance impact of adding schema-aware cache invalidation, and how could it be measured?