SP_CacheCompositeKey
Build a readable cache key from parts, the boring dependable way
- key
SP_CacheCompositeKey joins a few string parts into one key with a separator of your choice. That's the whole job, and it's deliberately boring. Where SP_CacheSmartHashKey hashes inputs into an opaque string, this one just concatenates - so the key you get is readable, greppable, and maps directly to a filename you can find on disk.
You reach for it when you want keys like job_flux_ultra_denoise05 instead of job_9f3a2b1c4d. The cache nodes in this pack file entries under whatever key string you give them, so a clean composite key is both a cache identifier and a human-legible label in your sp_node_cache folder.
How it works
prefix, part_A, part_B and part_C get joined with the separator - but only the parts that are actually filled in. Empty and whitespace-only parts are skipped, so prefix="job" and part_B="ultra" with everything else empty produces job_ultra, not job__ultra_. Default separator is _, which is a sane choice because underscores survive the cache's filename sanitization.
The output is a single key string you feed straight into SP_CacheAutoLoaderMulti's key input, the router, or anywhere else that takes a key.
The inputs that matter
- prefix - the start of the key. Often the workflow or job name.
- separator - the joiner, default
_. - part_A / part_B / part_C - optional middle and final parts. Everything is a string; numbers get coerced, so you can wire in a seed integer if you want.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/bananasss00/ComfyUI-SP-Nodes
restart, or install "SP-Nodes" via ComfyUI Manager. It's pure string work - no dependencies, no downloads.
Where people get burned
Remember what's not happening here: nothing is hashed, so two different part combos that stringify the same way genuinely collide. And keep in mind the cache's filename sanitization downstream - the key is used to build the .joblib filename, so characters outside A-Za-z0-9_- . get stripped. part_A="model:flux" will silently become modelflux in the filename while the in-memory key still has the colon, which is the kind of mismatch that makes cache lookups confusing. Stick to letters, digits and underscores in your parts and you'll never hit it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prefix | STRING | The initial part of the key. | |
| separator | STRING | _ | The character or string used to join the key parts. |
| part_Aopt | STRING | An optional middle part of the key. | |
| part_Bopt | STRING | Another optional middle part of the key. | |
| part_Copt | STRING | An optional final part of the key. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| key | STRING | — |