-
Notifications
You must be signed in to change notification settings - Fork 514
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
Respect Cache-Control headers #462
Changes from 4 commits
34a842c
f047d3c
4534575
9a79eba
ba0e9a8
c5fad07
b1ae25f
4dca22a
c3eb246
eacd424
b04831b
86b9ece
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 |
---|---|---|
|
@@ -60,6 +60,14 @@ typedef NS_OPTIONS(NSUInteger, PINRemoteImageManagerDownloadOptions) { | |
PINRemoteImageManagerDownloadOptionsIgnoreCache = 1 << 4, | ||
/** Skip download retry */ | ||
PINRemoteImageManagerDownloadOptionsSkipRetry = 1 << 5, | ||
/** | ||
* Do not honor HTTP Cache-Control headers | ||
* Currently PINRemoteImage will by default respect 'no-store', 'no-cache', 'max-age', 'Expires', and 'must-revalidate'. Set this flag to ignore those headers. | ||
* TODO: Currently PINRemoteImage will re-download images that only must be re-validated. In the future this could be improved with revalidation behavior that stores ETag or Last-Modified values and only | ||
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. Minor / optional: "By default, PINRemoteImage will respect...". Could also drop "Currently" in the next line, as presumably that will be updated if it becomes supported in the future. The next line also seems like it could use a line break to stay within a ~120 (or a bit more) column width — which isn't a hard rule for these frameworks, but up to ~150 works pretty well for Obj-C. Great comment overall, thanks for including the IETF and Mozilla links! |
||
* makes HEAD requests to see if these headers are unchanged. | ||
* see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control | ||
* https://tools.ietf.org/html/rfc7234*/ | ||
PINRemoteImageManagerDownloadOptionsIgnoreCacheControlHeaders = 1 << 6 | ||
}; | ||
|
||
/** | ||
|
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.
Super minor: maybe have this call
[self setObjectOnDisk:object forKey:key withAgeLimit:0];
?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.
OK