resize method

  1. @override
Future<void> resize(
  1. int maxSize
)
override

Resizes the cache to the new maxSize.

If the current size exceeds maxSize, this method will evict entries as needed. The operation is synchronized to ensure thread safety.

Implementation

@override
Future<void> resize(int maxSize) async {
  assert(maxSize > 0, 'maxSize must be greater than 0');
  await lock.synchronized(() {
    this.maxSize = maxSize;
    trimToSize(maxSize);
  });
}