def _retrieve_from_cache(url: str) -> dict[str, Any] | list[dict[str, Any]] | None:
    """
    Retrieve a HTTP response JSON object from the cache if it exists.

    A cache hit returns the data. A cache miss returns None.

    Parameters
    ----------
    url
        The URL of the request.

    Returns
    -------
    response_json
        The cached response for `url` if it exists, otherwise None.
    """
    # if the tool is configured to use the cache
    if settings.use_cache:
        # return cached response for this url if exists, otherwise return None
        cache_filepath = _check_cache(url)
        if cache_filepath is not None:
            response_json: dict[str, Any] | list[dict[str, Any]]
            response_json = json.loads(cache_filepath.read_text(encoding="utf-8"))
            msg = f"Retrieved response from cache file {str(cache_filepath)!r}"
            utils.log(msg, lg.INFO)
            return response_json

    return None

    Retrieve a HTTP response JSON object from the cache if it exists.

    A cache hit returns the data. A cache miss returns None.

    Parameters
    ----------
    url
        The URL of the request.

    Returns
    -------
    response_json
        The cached response for `url` if it exists, otherwise None.
    
osmnx/_http.py