clear method

void clear()

Implementation

void clear() {
  final callback = onEvict;
  if (callback != null) {
    for (var link = _head.next; link != _head; link = link.next) {
      final value = (link as _LruNode<K, V>).value;
      if (value != null) callback(value);
    }
  }
  _nodes.clear();
  _head
    ..next = _head
    ..previous = _head;
  _modifications++;
}