get method
Returns a snapshot of the entry named key
, or null if it doesn't exist
is not currently readable. If a value is returned, it is moved to the head
of the LRU queue.
Implementation
Future<Snapshot?> get(String key) => _lock.synchronized(() async {
await _initialize();
_checkNotClosed();
_validateKey(key);
final entry = _lruEntries[key];
if (entry == null) return null;
final snapshot = await entry.snapshot();
if (snapshot == null) return null;
_redundantOpCount++;
await _journalWriter!.writeLine('$_kRead $key');
if (_journalRebuildRequired()) {
_cleanup();
}
return snapshot;
});