close method

Future<void> close()

Closes this cache. Stored values will remain on the filesystem.

Implementation

Future<void> close() => _lock.synchronized(() async {
      if (!_initialized || _closed) {
        _closed = true;
        return;
      }

      // Copying for concurrent iteration.
      for (final entry in _lruEntries.values) {
        // Prevent the edit from completing normally.
        await entry.currentEditor?._detach();
      }
      await _trimToSize();
      await _journalWriter!.close();
      _journalWriter = null;
      _closed = true;
    });