factor get_cachefile_path function