migrateFrom method

Future<void> migrateFrom(
  1. CacheInfoRepository previousRepository
)

Implementation

Future<void> migrateFrom(CacheInfoRepository previousRepository) async {
  if (!await previousRepository.exists()) return;

  await previousRepository.open();
  final cacheObjects = await previousRepository.getAllObjects();
  await _putAll(cacheObjects);
  final isClosed = await previousRepository.close();
  if (!isClosed) {
    cacheLogger.log('Deleting an open repository while migrating.',
        CacheManagerLogLevel.warning);
  }
  await previousRepository.deleteDataFile();
}