Nodes/Caching to not Waste/Caching Text to not Waste
ComfyUI Node

Caching Text to not Waste

Caching_text remembers the prompt for you

By alastor-666-1933·Created about a year ago·Updated about a year ago· 13
Caching Text to not Waste
  • original_image
  • original_image
  • cached_text
identificationtext
executor
force_recreatefalse

You've built the classic inpainting workflow: run the source image through a WD14 or MiaoshouAI tagger to get a caption, hand it to a prompt node, and every single run the tagger re-processes the same image and generates the same text. On a weak GPU that's a model load plus a forward pass you did five minutes ago. caching_text is the "stop doing that" node - it runs the tagger once per image, saves the text, and hands it back forever after.

It's part of the Caching to not Waste pack (alastor-666-1933/caching_to_not_waste), built by a ComfyUI user who was sick of a 40-second inpainting workflow that re-did every resize, tag, and segmentation pass on each run. Text is just one of the things the pack remembers - there are sibling nodes for images, masks, controlnet images, and conditioning - but text is the one with the most fiddly wiring, so it's worth reading its quirks before you grab it.

How it works

The node takes your main image, computes an MD5 hash of its pixel data, appends your identification string, and uses that as a filename in ComfyUI/output/caching_to_not_waste. First run: it executes the executor input, writes the resulting string to a .txt file. Every run after: it finds the file, reads it, and returns it - and because the input is lazy-evaluated, the entire tagger chain feeding it never executes at all. That last bit is the real win. ComfyUI doesn't just skip the math; it never loads the model behind that chain, which is where most of your VRAM pressure was coming from.

The inputs and outputs that matter

Four required inputs:

  • original_image - the source image the cache is keyed on. Change a pixel, get a new cache.
  • executor - the chain of nodes whose text output you want to remember. Here's the quirk: the author notes this STRING input doesn't show up as a connector point by default. Drag a text output from another node onto it and it converts.
  • identification - a unique name for this cache entry. This one is critical. Every caching node in the pack shares one cache folder, and if two nodes use the same identification, the second overwrites the first. Default is "text" - you want something specific.
  • force_recreate - set it true once to ignore the cache and regenerate, then turn it back off.

It returns two outputs: original_image (a straight passthrough, handy for keeping the graph tidy) and cached_text - the remembered string. Wire cached_text into your CLIP Text Encode prompt, or anywhere else a string goes.

Installing it

ComfyUI Manager → Install Custom Nodes → search Caching to not Waste, or:

cd ComfyUI/custom_nodes
git clone https://github.com/alastor-666-1933/caching_to_not_waste

Then restart ComfyUI. That's it - no requirements.txt, no model downloads, nothing beyond what ComfyUI already ships. Delete the contents of ComfyUI/output/caching_to_not_waste whenever you want a fully cold start.

Where people get burned

The two classic traps: forgetting a unique identification (silent cache clobbering), and a stale cache after you change the tagger's settings or model. If you tweak the tagger and see the old caption coming back, flip force_recreate to true, run once, flip it back. Also remember the cache is keyed on the image, not the workflow - that's the feature, shared across every workflow you have that uses the same source image.

Categorycaching_to_not_wast

Inputs (4)

NameTypeDefaultDescription
identificationSTRINGtext
original_imageIMAGE
executorSTRING
force_recreateBOOLEANfalse

Outputs (2)

NameTypeDescription
original_imageIMAGE
cached_textSTRING