Caching Combined Image to not Waste
Cache a result that depends on two images, not one
- original_image_1
- original_image_2
- executor
- original_image_1
- original_image_2
- cached_image
Every other node in the Caching to not Waste pack caches a result keyed on a single source image. But some derived images only make sense relative to two inputs - a composite overlay, a difference map, an alpha blend between a render and its background. If you cache that with the single-image node, you're keying on one half of the equation, and the cache goes stale the moment you swap the other half. caching_from_combined_images is the variant that handles this: it hashes both input images together, so the cache only hits when both are the same.
It's the narrowest node in the pack, and the pack is already a niche utility - the author built it for the "overlay" case where a cached result depends on a pair of images. If you don't have that specific pattern, the plain caching_image node covers you. If you do, this is the one that won't silently serve you the wrong cached frame.
How it works
Same file-into-ComfyUI/output/caching_to_not_waste recipe as the rest of the pack, with one twist: the cache key is the concatenated pixel bytes of both source images plus your identification string, MD5'd into a filename. Change either input - even a single pixel of one of them - and you get a fresh cache. On a hit, the executor chain (which is lazy-evaluated) is skipped entirely, meaning whatever model or compositing pipeline produced the result never loads.
The inputs that matter
Five required inputs, but really three:
original_image_1andoriginal_image_2- the two source images that together define the cache.executor- an IMAGE input: the chain that produces the derived image (your overlay/composite step).identification- unique name for the entry. Default"image". As with every node in the pack, leaving multiple of these at the default means silent cache clobbering.force_recreate- true once to regenerate, then flip back.
Outputs: original_image_1 and original_image_2 (both passthrough, so the graph stays readable) and cached_image - the remembered composite, wired wherever the executor's output used to go.
Installing it
Manager → search Caching to not Waste, or:
cd ComfyUI/custom_nodes
git clone https://github.com/alastor-666-1933/caching_to_not_waste
Restart ComfyUI. No dependencies beyond ComfyUI itself, no model downloads. Cache files land in ComfyUI/output/caching_to_not_waste; delete the folder to clear everything.
Where people get burned
The usual stale-cache trap applies - change the composite logic upstream and flip force_recreate on once to bust the old entry. The subtler gotcha is the two-key design: because the cache is keyed on both images, it only pays off when both inputs are stable across runs. If you're swapping one image per batch and keeping the other fixed, this node still works (it just produces a new cache per pair). Where it's genuinely wasted effort is when you were going to regenerate anyway - then it's just disk usage. But for a fixed pair, it turns a heavy compositing step into a file load.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| identification | STRING | image | — |
| original_image_1 | IMAGE | — | |
| original_image_2 | IMAGE | — | |
| executor | IMAGE | — | |
| force_recreate | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| original_image_1 | IMAGE | — |
| original_image_2 | IMAGE | — |
| cached_image | IMAGE | — |