isFresh method

bool isFresh(
  1. String registryId,
  2. Duration ttl
)

Returns true if the cache entry for registryId is still within ttl.

Implementation

bool isFresh(String registryId, Duration ttl) {
  final entry = _store[registryId];
  if (entry == null) return false;
  final age = DateTime.now().toUtc().difference(entry.storedAt);
  return age <= ttl;
}