def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]:
        """
        The Cache decorator.

        :param func: The function to cache.
        :return: Wrapped function with caching.
        """

        def wrapper(*args: Any, **kwargs: Any) -> Generator[str, None, None]:
            key = md5(json.dumps((args[1:], kwargs)).encode("utf-8")).hexdigest()
            file = self.cache_path / key
            if kwargs.pop("caching") and file.exists():
                yield file.read_text()
                return
            result = ""
            for i in func(*args, **kwargs):
                result += i
                yield i
            if "@FunctionCall" not in result:
                file.write_text(result)
            self._delete_oldest_files(self.length)  # type: ignore

        return wrapper

        The Cache decorator.

        :param func: The function to cache.
        :return: Wrapped function with caching.
        
sgpt/cache.py