Instance Method
expirationDate(requestSentAt:)
Determines when the cached data should be expired.
func expirationDate(requestSentAt: Date) -> Date?
Parameters
requestSentAtShould be passed the
Datewhen the request was sent.
Discussion
This first checks to see if the Cache-Control header is present. If it is, and no-store is set, then nil is returned. If no-store is not present, and there is a max-age then the expiration will add that many seconds to requestSentAt.
If no Cache-Control header is present then it will examine the Expires header.
If you need finer grained details about what type of caching, validation, etc… you should instead grab the cacheControl and expires headers yourself.