shouldUseCache method

Future<bool> shouldUseCache(
  1. LocalRepository repository,
  2. CacheDescription? cache
)

Implementation

Future<bool> shouldUseCache(
    LocalRepository repository, CacheDescription? cache) async {
  if (kDebugMode) print('cache $cache ${cache?.key} ${cache?.lifeSpan}');
  if (cache == null || cache.key.isEmpty) return false;
  if (cache.invalidateCache) return false;
  if (cache.overrideTime) return true;
  return await repository.checkCache(cache.key);
}