onCapacity method
called if we want to
insert another item denoted by key
and element
into the map. This
method checks if the capacity is reached and eventually evicts old items.
Implementation
@override
void onCapacity(K key, V element) {
if (length < capacity) return;
storage.onCapacity(storage.keys.first);
}