Nodes/SP-Nodes/SP_CacheStore
ComfyUI Node

SP_CacheStore

Forcibly write a value into the SP-Nodes cache, every run

By bananasss00·Created 2 years ago·Updated 12 days ago· 20
SP_CacheStore
  • value
  • value
keydefault_key

Most of this pack's cache nodes are built around the idea of not recomputing something you already have. SP_CacheStore is the blunt exception: it forcibly writes a value into the cache under a key, overwriting whatever was there, every single time it runs. The pack's own description doesn't hedge: "Forcibly stores or overwrites a value in the cache."

Reach for this when you want an explicit, visible write - seeding a cache before a downstream SP_CacheGet needs it, or deliberately refreshing a stale entry as a distinct step in your graph rather than relying on a caching node's own overwrite logic.

How it works

Unlike SP_CacheAutoLoader or SP_CacheValue, there's no lazy evaluation here and no conditional logic - value always gets evaluated (whatever's upstream of it always runs) and always gets written to key. It's marked as an output node in ComfyUI terms, which means it executes for its side effect even if you leave its own output socket disconnected - you don't need to wire value back into anything downstream for the store to happen.

Inputs and outputs

  • key (STRING, required, default default_key) - where to write. Will overwrite an existing entry under the same key with no warning.
  • value (required, any type) - what to store.
  • Output: value - the same thing you just stored, passed through, so you can chain it into the rest of the graph if you want.

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 ComfyUI. No extra dependencies.

Common issues

It ran and overwrote something you wanted to keep. There's no confirmation and no conditional here - that's the entire point of this node versus SP_CacheValue's overwrite toggle. If you want write-once-then-leave-alone behavior, SP_CacheValue with overwrite set to false is the node you actually want; SP_CacheStore is for when overwriting every run is exactly the behavior you're after.

You don't see it run because nothing's connected to its output. That's expected, not a bug - it's an output node, so ComfyUI executes it for the side effect regardless of whether value (the output) feeds anything else. If you want visual confirmation it ran, wire a SP_DebugLogger off its output, or check the key afterward with SP_CacheCheck or SP_CacheManager's view action.

Two branches of a graph both store to the same key. Since there's no protection against collisions, if two SP_CacheStore nodes (or a mix of Store and Value/AutoLoader) share a key, whichever runs last wins and silently discards the other's write. Give each a distinct key, ideally built with SP_CompositeCacheKey rather than typed by hand.

CategorySP-Nodes/cache

Inputs (2)

NameTypeDefaultDescription
keySTRINGdefault_keyThe unique key to store the value under. Will overwrite if it already exists.
value*The value to be stored in the cache.

Outputs (1)

NameTypeDescription
value*