mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-21 16:50:07 +08:00
Adds a new on_set_prompt() lifecycle hook on CacheProvider that fires after the cache key set is prepared for a new prompt. Dispatched via asyncio.create_task with errors swallowed (same fail-safe pattern as on_store / on_lookup). Why: BasicCache's lifecycle notifications to external providers were incomplete. set_prompt is a key per-prompt event that providers need visibility into — for example, to reset per-prompt timing/state used for cost-aware caching policies (a provider can set t=0 here, then measure elapsed at each on_store to estimate compute saved by a hit). Backward-compatible: default implementation is a no-op, existing providers compile and run unchanged. Providers that need the per-prompt boundary override on_set_prompt().