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
Methods
-
assetFile(
String providerId, String cacheKey, String ext) → File -
The asset file for
cacheKeyunderproviderIdwith extensionext. -
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
cacheKeyunderproviderId. -
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>) andsidecarforcacheKeyunderproviderId.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited