def METHOD_NAME(raw_request: Dict, request: Request) -> Dict:
    """
    Construct the key for the cache using the raw request.
    Add `request.random` to the key, if defined.
    """
    if request.random is not None:
        assert "random" not in raw_request
        cache_key = {**raw_request, "random": request.random}
    else:
        cache_key = raw_request
    return cache_key