Better handling of creating cache files.