---
title: "requestIsCacheEquivalent(_:to:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/urlprotocol/requestiscacheequivalent(_:to:)"
---

# requestIsCacheEquivalent(_:to:)

A Boolean value indicating whether two requests are equivalent for cache purposes.

## Declaration

```swift
class func requestIsCacheEquivalent(_ a: URLRequest, to b: URLRequest) -> Bool
```

## Parameters

- `a`: The request to compare with bRequest.
- `b`: The request to compare with aRequest.

## Return Value

Return Value true if aRequest and bRequest are equivalent for cache purposes, false otherwise.

## Discussion

Discussion Requests are considered equivalent for cache purposes if and only if they would be handled by the same protocol and that protocol declares them equivalent after performing implementation-specific checks. The URLProtocol implementation of this method compares the URLs of the requests to determine if the requests should be considered equivalent. Subclasses can override this method to provide protocol-specific comparisons.
