Nodes/SP-Nodes/SP_CachePersistence
ComfyUI Node

SP_CachePersistence

Save or restore the entire SP-Nodes cache as one joblib file

By bananasss00·Created 2 years ago·Updated 12 days ago· 20
SP_CachePersistence
    • status
    action
    filepathcomfyui_cache.joblib

    The other cache nodes in this pack live entirely inside a running ComfyUI process (SP_CacheAutoLoader is the exception - it writes to disk automatically per key). SP_CachePersistence is different: it's a manual, all-at-once snapshot of the whole in-memory cache to a single file, using joblib. The pack's description: "Save cache to disk or load it back using joblib."

    Reach for this when you want to carry your entire cache state somewhere - back it up before doing something risky, hand a warmed-up cache to a different machine, or restore everything at once after a ComfyUI restart wiped the in-memory store.

    How it works

    Three actions, and the naming is worth reading carefully because two of them behave differently on load: save_to_disk dumps the current in-memory cache to filepath. load_from_disk reads it back - the naming suggests this replaces the in-memory cache with what's on disk, rather than adding to it. merge_from_disk is the one to use if you want to combine a saved cache file into whatever's already in memory without discarding entries that are already there. If you're not sure which you want, merge_from_disk is the safer default - it's harder to accidentally lose something with it.

    Inputs and outputs

    • action (required, enum: save_to_disk, load_from_disk, merge_from_disk).
    • filepath (STRING, required, default comfyui_cache.joblib) - the full path to read from or write to.
    • Output: status (STRING) - reports what happened; worth checking after a save to confirm it actually wrote something, especially the first time.

    Installing it

    ComfyUI Manager - search "SP-Nodes", install, restart. Manually:

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

    then restart. This node specifically needs joblib on the Python side to serialize the cache - a common package that's already present in a lot of ML-adjacent Python environments, but if ComfyUI's console throws a missing-module error for it after you install the pack, pip install joblib in the same virtual environment ComfyUI runs in will fix it.

    Common issues

    load_from_disk didn't bring back what you expected. If it replaces the in-memory cache outright rather than merging, anything cached since ComfyUI started that wasn't part of the saved file is gone after loading. If you want the saved entries added to what's already there, use merge_from_disk instead.

    The file isn't where you think it is. filepath is whatever string you give it - relative paths resolve against ComfyUI's working directory, not the pack's folder or your models directory. Use an absolute path if you're moving the file between machines or scripts and want to be certain.

    A save_to_disk run happened on an empty cache. If nothing had been cached yet in this session - nothing ran through SP_CacheAutoLoader, SP_CacheStore or SP_CacheValue first - there's nothing to persist. Check the status output; an empty save isn't an error, it's just not useful.

    CategorySP-Nodes/cache

    Inputs (2)

    NameTypeDefaultDescription
    actionCOMBOThe persistence action to perform.
    filepathSTRINGcomfyui_cache.joblibThe full path to the file for saving or loading the cache.

    Outputs (1)

    NameTypeDescription
    statusSTRING