MovaTwoLevelCache class

Composes a fast synchronous level (memory) over a slow persistent one (disk).

peek only ever consults memory, so a scrub that lands on an already resident bucket renders in the same frame. read falls through to disk and back-fills memory so the next scrub over the same bucket is instantaneous. write fans out to both levels.

把一个同步的快速层(内存)叠加在慢速持久层(磁盘)之上。

peek 只查 memory,因此拖到已驻留的桶时可在同一帧渲染出来。read 会 下探到 disk 并回填 memory,让下次拖到同一个桶时瞬时命中。write 同时 写入两层。

Implemented types

Constructors

MovaTwoLevelCache({required IMovaThumbCache memory, required IMovaThumbCache disk})
Creates a two-level cache over memory and disk.

Properties

disk → IMovaThumbCache
The slow, persistent level.
final
hashCode → int
The hash code for this object.
no setterinherited
memory → IMovaThumbCache
The fast level; must answer IMovaThumbCache.peek without I/O.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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 key if 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 bytes under key, evicting as needed to stay within limits.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited