Is there a fetch policy for getCustomerInfo that translates to,
- Go to network, get the most recent
- If network fails, use cache if not stale
- Return error if cache is stale
Basically, “fetchedOrNotStaleCached”, borrowing from the policy names below. Is there any reason this is not supported (so I don’t try to create it through extra code either)? I thought maybe a rate limit is behind this, but not sure now (it seems a rate limit of 5 minutes for this type of policy for example would become effectively “notStaleCachedOrFetched”).
public enum CacheFetchPolicy: Int {
/// Returns values from the cache, or throws an error if not available.
case fromCacheOnly
/// Always fetch the most up-to-date data.
case fetchCurrent
/// Returns the cached data if available and not stale, or fetches up-to-date data.
/// - Warning: if the cached data is stale, and fetching up-to-date data fails (if offline, for example)
/// an error will be returned instead of the outdated cached data.
case notStaleCachedOrFetched
/// Default behavior: returns the cached data if available (even if stale), or fetches up-to-date data.
case cachedOrFetched
/// Default ``CacheFetchPolicy`` behavior.
public static let `default`: Self = .cachedOrFetched
}