def _save_to_cache(
    url: str,
    response_json: dict[str, Any] | list[dict[str, Any]],
    ok: bool,  # noqa: FBT001
) -> None:
    """
    Save a HTTP response JSON object to a file in the cache folder.

    If request was sent to server via POST instead of GET, then `url` should
    be a GET-style representation of the request. Response is only saved to a
    cache file if `settings.use_cache` is True, `ok` is True, `response_json`
    is not None, and `response_json` does not contain a server "remark."

    Users should always pass OrderedDicts instead of dicts of parameters into
    request functions, so the parameters remain in the same order each time,
    producing the same URL string, and thus the same hash. Otherwise you will
    get a cache miss when the URL's parameters appeared in a different order.

    Parameters
    ----------
    url
        The URL of the request.
    response_json
        The JSON HTTP response.
    ok
        A `requests.response.ok` value.
    """
    if settings.use_cache:
        if not ok:  # pragma: no cover
            msg = "Did not save to cache because HTTP status code is not OK"
            utils.log(msg, level=lg.WARNING)
        elif isinstance(response_json, dict) and ("remark" in response_json):  # pragma: no cover
            msg = f"Did not save to cache because response contains remark: {response_json['remark']!r}"
            utils.log(msg, lg.WARNING)
        else:
            # create cache folder on disk if it doesn't already exist
            cache_filepath = _resolve_cache_filepath(url)
            cache_filepath.parent.mkdir(parents=True, exist_ok=True)
            cache_filepath.write_text(json.dumps(response_json), encoding="utf-8")
            msg = f"Saved response to cache file {str(cache_filepath)!r}"
            utils.log(msg, level=lg.INFO)

    Save a HTTP response JSON object to a file in the cache folder.

    If request was sent to server via POST instead of GET, then `url` should
    be a GET-style representation of the request. Response is only saved to a
    cache file if `settings.use_cache` is True, `ok` is True, `response_json`
    is not None, and `response_json` does not contain a server "remark."

    Users should always pass OrderedDicts instead of dicts of parameters into
    request functions, so the parameters remain in the same order each time,
    producing the same URL string, and thus the same hash. Otherwise you will
    get a cache miss when the URL's parameters appeared in a different order.

    Parameters
    ----------
    url
        The URL of the request.
    response_json
        The JSON HTTP response.
    ok
        A `requests.response.ok` value.
    
osmnx/_http.py