LoRA Cache Preloader
Eat the CivitAI lookup cost on your schedule
- status
- cached_count
The random LoRA nodes in this pack get their trigger words by hashing each LoRA file and asking the CivitAI API for the trained words. That lookup is slow-ish and, with a big library, it happens one file at a time on your first real run - which means your "quick test" grinds to a halt while the node fetches metadata for fifty LoRAs it just rolled. The LoRA Cache Preloader exists to front-load that work: run it once, and all that metadata lands in the pack's db.json cache before you ever hit the randomizer for real.
It's a utility node, not part of the generation chain. Think of it as a warm-up lap.
How it works
You set folder_path (a dropdown of your lora subfolders, or "All folders") and flip preload_cache to True. The node walks that folder, finds every .safetensors/.pt file, and calls the same cached LoRA-info function the folder selector nodes use - hashing each file and querying CivitAI when it isn't cached yet. Results pile into the shared db.json cache (and the in-memory cache the folder nodes use), and the node reports how many it processed and how long it took.
Flip preload_cache back to False and it just reports the current cache size. The IS_CHANGED hook only forces a rerun when preload_cache is True, so leaving it False keeps it inert.
Inputs / outputs
preload_cache(required, default False) - the trigger. True runs the preload.folder_path(required) - "All folders" or one subfolder.- Outputs:
status(a string likePreloaded 47/50 LoRAs from All folders in 9.3s (errors: 2)) andcached_count(how many entries the cache holds now).
When it's actually worth it
This node only earns its place if your loras folder is big and you care about trigger words. Small library? The first random run's stall is seconds; skip this. Fifty-plus files, or you're about to run a long batch with folder roulette? A one-time preload turns the first real run from a crawl into instant.
Two honest caveats:
- It needs network. The cache fills from the CivitAI API by sha256. Files not on CivitAI get cached as "No information found" - which is still a cache hit, so at least the miss is remembered.
- The cache is per-pack.
db.jsonlives inside thesantodan-custom-nodes-comfyuifolder. Switching checkouts or deleting the pack wipes it. Also, since the folder-selector nodes cache in memory per session, the preloader's main lasting artifact is thatdb.json- the in-memory cache still repopulates each ComfyUI session from disk, which is fast.
force_refresh_cache on the folder nodes clears the in-memory cache, not db.json - different layers. If you want trigger-word data re-fetched from CivitAI entirely, delete db.json (or edit it) rather than expecting this node to do it.
Install
ComfyUI Manager (search "Santodan"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/Santodan/santodan-custom-nodes-comfyui
Restart. No dependencies, no downloads - it operates on your existing loras folder and network.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| preload_cache | BOOLEAN | false | — |
| folder_path | COMBO | All folders | 1 options: All folders |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| status | STRING | — |
| cached_count | INT | — |