Cache Backend Data (Inspire)
Stash data in memory and reuse it across runs
- data
- data opt
This is a stash box that lives in ComfyUI's memory. You hand it some data and a string key; it holds onto that data so you - or a completely different workflow - can pull it back later with the same key using the matching Retrieve Backend Data (Inspire) node. The data survives across queue runs and across workflow switches, because it's parked in the backend, not in the graph.
Why would you want that? The headline case is not reloading heavy things. Switching between workflows normally means re-loading checkpoints and models from disk every time. Cache the expensive object once and later runs just grab it from memory. (Inspire even has purpose-built Shared Checkpoint Loader nodes built on this same cache for exactly that.) More generally, it's how you pass data between separate workflows that otherwise share nothing - compute something in one, use it in another.
How it works
The cache is a simple key→value store kept alive in the backend process. Cache Backend Data writes: it takes your data and files it under key, with a tag for grouping. Retrieve Backend Data reads it back by the same key. The value can be literally anything - a model, a latent, an image, a string - because the input is a wildcard type. It stays cached until you overwrite it, clear it with a Remove Backend Data node, or restart ComfyUI (it's memory, not disk, so a restart wipes it).
The inputs and outputs that matter
key(STRING) - the unique name you store under and retrieve by. Reuse the same key in a Retrieve node to get the data back. Reusing it in another Cache node overwrites what's there.tag(STRING) - a label for grouping/quick reference. Tags also drive the cache-size settings (each tag has a default max entry count you can tune), so it's not purely cosmetic.data(type*) - the thing you're caching. Anything goes.
The output is data opt (type *) - a pass-through of the same data, so you can splice this node inline in a chain rather than dead-ending it. It's also an output node, so it can sit at the end of a branch purely to perform the caching.
How to install it
ComfyUI Manager: search ComfyUI Inspire Pack, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack
then restart. It's from Dr.Lt.Data - fittingly, the same person behind ComfyUI-Manager, so caching infrastructure is on-brand.
Common issues & troubleshooting
The data's gone after a restart. Expected. This is an in-memory cache, not persistent storage. Restarting ComfyUI clears everything. If you need data to survive a restart, save it to disk instead.
Retrieve returns nothing / errors. The keys must match exactly, and the Cache node has to have actually run before the Retrieve node reads. If they're in different workflows, run the caching workflow first. Watch for typos and stray whitespace in the key.
My cached entry vanished on its own. Each tag has a maximum number of entries (default is small - around 5). Caching new items under the same tag evicts the oldest once you exceed the limit. Give important data its own tag, or bump the tag's size via the Show Cached Info node.
Execution order is wrong - it caches after the consumer runs. ComfyUI doesn't guarantee ordering between unconnected branches. If you need the cache written before something else reads it, chain them (use the data opt pass-through) so there's an actual dependency, rather than leaving them as parallel islands.
Memory keeps climbing. You're caching big objects (models, large batches) and never clearing them. Use Remove Backend Data to free a key when you're done with it - and remember * as the key clears everything.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | — | |
| tag | STRING | — | |
| data | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| data opt | * | — |