refactored file cache handling into its own class