MovaMemoryThumbCache class
An in-memory IMovaThumbCache with byte- and count-based LRU eviction.
Stores encoded bytes (not decoded ui.Images) so the core layer stays free
of Flutter types and memory usage stays predictable.
基于字节数和条目数做 LRU 淘汰的内存 IMovaThumbCache。
存的是编码后的字节(而非已解码的 ui.Image),从而让 core 层不依赖
Flutter 类型,内存占用也更可预测。
- Implemented types
Constructors
- MovaMemoryThumbCache({int maxEntries = 40, int maxBytes = 8 * 1024 * 1024})
-
Creates an in-memory cache holding at most
maxEntriesthumbnails.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Number of resident entries.
no setter
- maxBytes → int
-
编码字节预算,非正值禁用缓存。
final
- maxEntries → int
-
Maximum number of resident entries;
0or negative disables caching.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalBytes → int
-
返回当前字节占用;示例:
cache.totalBytes。no setter
Methods
-
clear(
) → Future< void> -
Removes every entry.
override
-
dispose(
) → Future< void> -
Releases any resources held by this cache; does not imply clear.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peek(
String key) → Uint8List? -
Returns the bytes for
keyif they are resident and cheap to fetch, otherwise null. Must never do I/O.override -
read(
String key) → Future< Uint8List?> -
Returns the bytes for
key, possibly hitting slower storage.override -
toString(
) → String -
A string representation of this object.
inherited
-
write(
String key, Uint8List bytes) → Future< void> -
Stores
bytesunderkey, evicting as needed to stay within limits.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited