16644 - should have 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