isExpired method

bool isExpired([
  1. DateTime? now
])

Returns true if the entry is completely expired and must not be served under normal conditions.

Implementation

bool isExpired([DateTime? now]) {
  final current = (now ?? DateTime.now().toUtc());
  final age = current.difference(createdAt);
  final maxAge =
      ttl +
      (staleWhileRevalidate ?? Duration.zero) +
      (staleIfError ?? Duration.zero);
  return age > maxAge;
}