get method
Retrieves the value associated with the given key
, or null
if not present.
Updates hit/miss statistics accordingly. The operation is thread-safe.
Implementation
@override
Future<Uint8List?> get(String key) async {
assert(key.isNotEmpty, 'key must not be empty');
return await lock.synchronized(() {
Uint8List? mapValue = map[key];
if (mapValue != null) {
hitCount++;
return mapValue;
}
missCount++;
return null;
});
}