GenerativeCache class final

A committable, content-addressed store for produced generative assets.

Each asset is written under <root>/<provider>/<cacheKey>.<ext> with a <cacheKey>.json sidecar describing it (prompt, seed, params, mime, duration, dimensions). Writes are atomic (temp file then rename) so a crashed render never leaves a half-written asset the next run would treat as a cache hit.

Constructors

GenerativeCache(String root)
Creates a cache rooted at root.

Properties

hashCode int
The hash code for this object.
no setterinherited
root String
The cache root directory path.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

assetFile(String providerId, String cacheKey, String ext) File
The asset file for cacheKey under providerId with extension ext.
has(String providerId, String cacheKey) bool
Whether a sidecar (and thus a produced asset) exists for cacheKey.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readSidecar(String providerId, String cacheKey) Map<String, Object?>
Reads and decodes the sidecar for cacheKey.
sidecarFile(String providerId, String cacheKey) File
The sidecar metadata file for cacheKey under providerId.
toString() String
A string representation of this object.
inherited
write({required String providerId, required String cacheKey, required String ext, required Uint8List bytes, required Map<String, Object?> sidecar}) Future<void>
Atomically writes bytes (as <cacheKey>.<ext>) and sidecar for cacheKey under providerId.

Operators

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