Back to Alamofire

ResponseCacher

docs/Structs/ResponseCacher.html

5.12.01.6 KB
Original Source

ResponseCacher

public struct ResponseCacher
extension ResponseCacher: CachedResponseHandler

ResponseCacher is a convenience CachedResponseHandler making it easy to cache, not cache, or modify a cached response.

`

                Behavior
                `

Defines the behavior of the ResponseCacher type.

See more

Declaration

Swift

public enum Behavior : Sendable

`

                cache
                `

Returns a ResponseCacher with a .cache Behavior.

Declaration

Swift

public static let cache: ResponseCacher

`

                doNotCache
                `

Returns a ResponseCacher with a .doNotCache Behavior.

Declaration

Swift

public static let doNotCache: ResponseCacher

`

                behavior
                `

The Behavior of the ResponseCacher.

Declaration

Swift

public let behavior: Behavior

`

                init(behavior:)
                `

Creates a ResponseCacher instance from the Behavior.

Declaration

Swift

public init(behavior: Behavior)

Parameters

| behavior |

The Behavior.

|

`

                dataTask(_:willCacheResponse:completion:)
                `

Declaration

Swift

public func dataTask(_ task: URLSessionDataTask,
                     willCacheResponse response: CachedURLResponse,
                     completion: @escaping (CachedURLResponse?) -> Void)