def get_client_cache_key(request_or_attempt: Union[HttpRequest, Any], credentials: dict = None) -> str:
if isinstance(request_or_attempt, HttpRequest):<EOL><INDENT>username = get_client_username(request_or_attempt, credentials)<EOL>ip_address = get_client_ip_address(request_or_attempt)<EOL>user_agent = get_client_user_agent(request_or_attempt)<EOL><DEDENT>else:<EOL><INDENT>username = request_or_attempt.username<EOL>ip_address = request_or_attempt.ip_address<EOL>user_agent = request_or_attempt.user_agent<EOL><DEDENT>filter_kwargs = get_client_parameters(username, ip_address, user_agent)<EOL>cache_key_components = '<STR_LIT>'.join(filter_kwargs.values())<EOL>cache_key_digest = md5(cache_key_components.encode()).hexdigest()<EOL>cache_key = f'<STR_LIT>'<EOL>return cache_key<EOL>
Build cache key name from request or AccessAttempt object.

:param request_or_attempt: HttpRequest or AccessAttempt object
:param credentials: credentials containing user information
:return cache_key: Hash key that is usable for Django cache backends