resize method
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);
});
}