checkAddressesCacheTimeout method

bool checkAddressesCacheTimeout(
  1. Duration cacheTimeout
)

Checks if the address cache has exceeded the specified timeout.

If the cache has expired, it clears the cache.

  • cacheTimeout: The duration after which the cache is considered expired.
  • Returns true if the cache was cleared; otherwise, false.

Implementation

bool checkAddressesCacheTimeout(Duration cacheTimeout) {
  var elapsedTime = DateTime.now().difference(_addressesCacheCleanTime);
  if (elapsedTime > cacheTimeout) {
    clearAddressesCache();
    return true;
  }
  return false;
}