isExpired method
Checks if response is expired.
Implementation
bool isExpired(CacheControl rqCacheCtrl) {
final ageMillis = _cacheResponseAge();
var freshMillis = _computeFreshnessLifetime();
final maxAge = rqCacheCtrl.maxAge;
if (maxAge > -1) {
freshMillis = min(freshMillis, maxAge * 1000);
}
final maxStaleMillis =
(!cacheControl.mustRevalidate && rqCacheCtrl.maxStale > -1)
? rqCacheCtrl.maxStale * 1000
: 0;
final minFreshMillis = max(0, rqCacheCtrl.minFresh * 1000);
if (!cacheControl.noCache &&
ageMillis + minFreshMillis < freshMillis + maxStaleMillis) {
return false;
}
return true;
}