(#16644) Add a generic file cache

Add a general file cacher in Hiera::Filecache based on the work that was
done in the YAML backend.

Adjust the YAML and JSON backends to use this cache and update tests

The YAML tests had a bunch of unneeded calls to YAML.load in them so
refactored those to have the already-parsed data in them like the JSON
backend has