Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
PUP 4.9.3
-
None
-
-
Puppet Developer Experience
-
2
-
PDE 2017-03-08
-
Bug Fix
-
A regression in hiera 5 was found where parsed hiera data files were not cached. Now they are.
-
No Action
-
perf; covered by unit benchmarks and tests
Description
Parsing YAML and JSON files is a slow process and classic Hiera used a FileCache class that would store the parsed result indefinitely but discard it in case the inode, mtime, or size of the source file changed.
Hiera 5 must have a similar cache and it should share the environment life-cycle rather than being indefinite. The cache should be made available to a data provider function in a similar way that the classic Hiera does. By using a method on the Context that takes the path as an argument and expects a block to produce the parsed result for caching. The block is then only called when the file has changed.