From cf1c0c6197bbe0f995171cc7761a61903cff7850 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 1 Dec 2024 16:54:16 -0800 Subject: [PATCH] Add CacheControlInfo.isExpired calculated property. --- RSWeb/Sources/RSWeb/CacheControlInfo.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RSWeb/Sources/RSWeb/CacheControlInfo.swift b/RSWeb/Sources/RSWeb/CacheControlInfo.swift index c1da4f1ef..69766b17a 100644 --- a/RSWeb/Sources/RSWeb/CacheControlInfo.swift +++ b/RSWeb/Sources/RSWeb/CacheControlInfo.swift @@ -9,12 +9,15 @@ import Foundation /// Basic Cache-Control handling — just the part we need, /// which is to know when we got the response (dateCreated) -/// and when we can ask again (dateExpired). +/// and when we can ask again (isExpired, dateExpired). public struct CacheControlInfo: Codable, Equatable { let dateCreated: Date let maxAge: TimeInterval + var isExpired: Bool { + Date() > dateExpired + } var dateExpired: Date { dateCreated + maxAge }