limitCacheSize static method
限制解码字节条数,按 LRU 同步淘汰关联尺寸及无效标记。
Implementation
static void limitCacheSize(int maxSize) {
final target = maxSize < 0 ? 0 : maxSize;
var count = base64CacheSize;
for (final key in _base64Cache.keys.toList()) {
if (count <= target) break;
if (_base64Cache[key]!.bytes == null) continue;
_base64Cache.remove(key);
count--;
}
}