Move file cache hashing into separate class and fix unit tests