-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/cache logic #78
Changes from all commits
cf56936
3703aea
fab1e31
636babb
583a006
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ public struct UBURLRequest: Equatable, Hashable, CustomReflectable, CustomString | |
/// - method: The HTTP Method to use. Default to GET. | ||
/// - timeoutInterval: The timeout interval for the request. The default is 60.0. | ||
public init(url: URL, method: UBHTTPMethod = .get, timeoutInterval: TimeInterval = 60.0) { | ||
self.init(request: URLRequest(url: url, cachePolicy: .reloadIgnoringCacheData, timeoutInterval: timeoutInterval)) | ||
self.init(request: URLRequest(url: url, cachePolicy: .useProtocolCachePolicy, timeoutInterval: timeoutInterval)) | ||
httpMethod = method | ||
} | ||
Comment on lines
93
to
98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The verification script has identified multiple instances in the codebase where
Analysis chainThe change to the default cache policy in the Given the absence of results from the script, it's not possible to confirm that the change to the default cache policy in The absence of results from the broader search pattern still does not provide confirmation that the change to the default cache policy in |
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,9 +112,11 @@ class UBURLSessionDelegate: NSObject, URLSessionTaskDelegate, URLSessionDataDele | |
let request = task.currentRequest { | ||
session.configuration.urlCache?.storeCachedResponse(newCachedResponse, for: request) | ||
} | ||
ubDataTask.dataTaskCompleted(data: cached.data, response: cached.response as? HTTPURLResponse, error: collectedData.error ?? error, info: info) | ||
if !ubDataTask.flags.contains(.refresh) { | ||
ubDataTask.dataTaskCompleted(data: cached.data, response: cached.response as? HTTPURLResponse, error: collectedData.error ?? error, info: info) | ||
} | ||
Comment on lines
+115
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new condition checks if the The conditional check for the The conditional check for the
|
||
if let response = cached.response as? HTTPURLResponse { | ||
cachingLogic?.hasUsed(response: response, metrics: collectedData.metrics, request: collectedData.request, dataTask: ubDataTask) | ||
cachingLogic?.hasUsed(cachedResponse: response, nonModifiedResponse: response, metrics: collectedData.metrics, request: collectedData.request, dataTask: ubDataTask) | ||
} | ||
return | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
prepareRequest
method correctly sets thecachePolicy
to.reloadIgnoringLocalCacheData
. Ensure that the implications of this change in caching behavior are well-documented and communicated to consumers of theUBBaseCachingLogic
class.