maximumSizeBytes property

int maximumSizeBytes

Maximum size of entries to store in the cache in bytes.

Once more than this amount of bytes have been cached, the least-recently-used entry is evicted until there are fewer than the maximum bytes.

Implementation

int get maximumSizeBytes => _maximumSizeBytes;
void maximumSizeBytes= (int value)

Changes the maximum cache bytes.

If the new size is smaller than the current size in bytes, the extraneous elements are evicted immediately. Setting this to zero and then returning it to its original value will therefore immediately clear the cache.

Implementation

set maximumSizeBytes(int value) {
  assert(value != null);
  assert(value >= 0);
  if (value == _maximumSizeBytes)
    return;
  _maximumSizeBytes = value;
  if (_maximumSizeBytes == 0) {
    clear();
  } else {
    _checkCacheSize();
  }
}