Nodes/SP-Nodes/SP_CacheAutoLoaderMulti
ComfyUI Node

SP_CacheAutoLoaderMulti

The SP-Nodes multi-slot auto loader

By bananasss00·Created 2 years ago·Updated 14 days ago· 24
SP_CacheAutoLoaderMulti
  • value_1
  • value_2
  • value_3
  • value_4
  • value_5
  • value_1
  • value_2
  • value_3
  • value_4
  • value_5
  • status
keydefault_multi_key
cache_directorysp_node_cache
compression_level0
enabledtrue

Most "cache" talk in ComfyUI is about inference caching - TeaCache, CacheDiT, skipping diffusion steps to make sampling faster. This node is not that. SP_CacheAutoLoaderMulti caches workflow data: whatever values you wire into it, filed under a key you pick, so the slow upstream part of your graph only ever runs once. It's a bookmark for a bundle of values, not a speed hack for the sampler.

It's the multi-slot sibling of the pack's single-value SP_CacheAutoLoader. Where that node caches one thing per key, this one caches up to five things under the same key - saved together, loaded together, skipped together. When you have a set of values that always travel as a unit (a checkpoint plus a LoRA stack plus a prompt plus a seed), you get one entry to reason about instead of five cache nodes to keep in sync.

How it works

The lookup is three-tier: memory → disk → compute. First it checks a global in-memory dictionary; miss that, and it checks the cache directory on disk (a joblib file named <sanitized-key>_multi.joblib); miss that, and then - and only then - it evaluates value_1 through value_5 and saves the result. Saving runs in a background thread, so the UI doesn't freeze while a large latent gets written out.

The lazy inputs are what make it feel smart. Each value input is marked lazy, and check_lazy_status only asks ComfyUI to evaluate the inputs that are actually connected - and only on a genuine miss. On a hit it requests nothing, so the upstream nodes literally never execute. The source even calls out the fix: only wired inputs get requested, which avoids the "node says it needs input but there is no input" crash that lazy evaluation can otherwise cause.

The inputs and outputs that matter

You mostly touch four things:

  • key - the unique name for the entry. Change it to start a fresh cache.
  • cache_directory - where the file lands, default sp_node_cache. It's relative to ComfyUI's working directory, so look next to ComfyUI, not inside the custom node folder.
  • compression_level - 0 is fastest but largest files, 3 is balanced, 9 is smallest but slowest. Default 0; bump to 3 if you're caching big stuff.
  • enabled - flip off and the node just passes values through, no caching.

Then value_1value_5 are the things you're caching (any type), and the outputs mirror them plus a status string that tells you "Loaded from memory", "Loaded from disk", or "Newly computed and cached". That status wire is genuinely handy for diagnosing why a run is - or isn't - serving old results.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/bananasss00/ComfyUI-SP-Nodes

then restart ComfyUI. Or search "SP-Nodes" in ComfyUI Manager and hit install. The cache machinery only needs joblib, which is in the pack's requirements.txt alongside nltk (that one powers the PromptChecker, not the cache). No model downloads.

Where people get burned

Same key with changed inputs = you get the old values. That's the deal, but everyone forgets it once - change the key, or wire in SP_CacheSmartHashKey so the key derives from the inputs. Also remember the key gets sanitized for the filename: only letters, digits, _ - . survive, so my:key and my-key map to the same file on disk. The in-memory cache resets on restart; the .joblib file persists. Delete the file to hard-reset an entry.

CategorySP-Nodes/cache

Inputs (9)

NameTypeDefaultDescription
keySTRINGdefault_multi_keyThe unique key for the cache entry.
cache_directorySTRINGsp_node_cacheThe directory on disk where the cache file will be stored.
compression_levelINT00–90 = Fastest but large files. 3 = Balanced. 9 = Smallest files but slow.
enabledBOOLEANtrueIf False, the node will simply pass the values through without any caching.
value_1opt*Value 1 to cache.
value_2opt*Value 2 to cache.
value_3opt*Value 3 to cache.
value_4opt*Value 4 to cache.
value_5opt*Value 5 to cache.

Outputs (6)

NameTypeDescription
value_1*
value_2*
value_3*
value_4*
value_5*
statusSTRING