BD Cache String
Cache a string? Yes, and here's the surprisingly real use case
- text
- status
A text cache sounds like the least impressive node in the pack, and honestly it kind of is - until you hit the workflow where a string is genuinely expensive to produce. That happens more than you'd think. The obvious one: an LLM call inside ComfyUI (a prompt-generation node, a QwenVL caption, a structured part-list from a VLM) that costs seconds and API tokens every single run. BD Cache String freezes the output so that call happens once and every later run skips the model and reads the saved text back. Same lazy-evaluation mechanism as the image/latent caches - on a hit, upstream is skipped entirely.
Where it really earns its keep is in prompt iteration and save-context workflows. The BrainDead pack's whole Save Context system resolves paths from string templates. If one of those template variables comes from a node that computes it - a caption, an LLM-generated filename, a label list - caching the string lets you iterate on the render side without re-triggering the text side, and it keeps your save paths stable across runs. It's plumbing, but it's plumbing that stops you re-paying for generation you already did.
The inputs
- text - the STRING to cache. Multiline, so whole prompts or caption blocks are fine.
- cache_name - label (default
cached_string). - seed - invalidation key, hashed into the filename. Change it to force a fresh generation of the text.
- force_refresh - True to overwrite the cache and run upstream again.
- name_prefix - optional path prefix under
output/BrainDead_Cache/.
Outputs: text (STRING) and status (STRING). Save format is plain TXT, which means you can also treat the cache folder as a lightweight record of the exact prompt that produced a run - open the file and there it is, unescaped and human-readable.
The workflow shape
[LLM prompt / caption node] → [BD Cache String] → [CLIP Text Encode / save context]
cache_name: "prompt_base"
seed: 7
First run computes the text and writes the TXT. Every run after that skips the LLM node entirely and feeds the cached string downstream. If you're one of those people iterating on a character sheet for hours with the same prompt block, that's a lot of skipped API calls.
Installing it
From BizaNator/ComfyUI-BrainDead (BrainDeadGuild). ComfyUI Manager → search "BrainDead" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt
Restart; it's under 🧠BrainDead/Cache.
Gotchas
Same family rules: the cache is keyed on seed, so a changed LLM input with an unchanged seed serves you stale text silently. And honestly, if the string is static and typed by hand, don't bother with this node - you'd just be adding a file round-trip for no gain. Its job is caching computed strings, and it only pays off when the computation is the expensive part.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| cache_name | STRING | cached_string | — |
| seed | INT | 00–18446744073709550000 | — |
| force_refresh | BOOLEAN | false | — |
| name_prefixopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| status | STRING | — |