def METHOD_NAME(filename: Union[str, Path]) -> str:
    "Return the md5 hex digest of the file contents."
    if isinstance(filename, Path):
        filename = filename.as_posix()
    mtime = os.path.getmtime(filename)
    key = f"{filename}-{mtime}"
    if filename not in CACHE_CHECKSUM_FILE:
        CACHE_CHECKSUM_FILE.add(key, checksum_file_nocache(filename))
    return CACHE_CHECKSUM_FILE[key]