Call as
Functions.cache.getCached(cache, func, ...)
Record it as a dependency named Functions.cache.getCached (accepting the completion does this), then call it by that name.
Also accepted under the former namespace utils.
What it does
Call an observation once per cache and exact argument tuple, including nil results. Pass the evaluation cache to share observations within a recommendation cycle; nil cache calls directly.
Arguments
| Name | Type | What it does |
|---|---|---|
cache | table | nil | Evaluation cache, or nil to bypass caching. |
func | function | string | Function or global function name to call. |
... | any | Arguments forwarded unchanged; types, identity, arity and nil positions distinguish cache entries. |
Returns
| 1 | ... | All original results, preserving nil positions and return count. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
How the addon calls it
- Any Spell Available (evaluate)
return Functions.cache.getCached(cache, addon.Platform.IsSpellReady, addon.Platform, spellid, evalStart) - Any Spell Charges (evaluate)
local charges, why = Functions.cache.getCached(cache, addon.Platform.GetSpellCharges, addon.Platform, spellid) - Any Spell Cooldown (evaluate)
local cooldown, why = Functions.cache.getCached(cache, addon.Platform.GetSpellCooldown, addon.Platform, spellid) - Any Spell In Range (evaluate)
local exists,presenceReason=Functions.cache.getCached(cache, addon.Platform.GetUnitPresenceObservation, addon.Platform, "target") - Any Spell Recharge Time (evaluate)
local charges, why = Functions.cache.getCached(cache, addon.Platform.GetSpellCharges, addon.Platform, spellid) - Assisted Combat Available (evaluate)
local available, why = Functions.cache.getCached(cache, addon.Platform.GetAssistedCombatAvailability, addon.Platform) - Assisted Combat Rotation Spell (evaluate)
return Functions.cache.getCached(cache, addon.Platform.IsAssistedRotationSpell, addon.Platform, spellid) - Assisted Combat Suggestion (evaluate)
local suggestion, reason = Functions.cache.getCached(cache, addon.Platform.GetAssistedSuggestion, addon.Platform)
and 82 more: Attackable (evaluate), Casting (evaluate), Cast Progress (evaluate), Cast Time Remaining (evaluate), Specific Spell Casting (evaluate), Cast Interruptible (evaluate), Channeling (evaluate), Channel Progress (evaluate), Channel Time Remaining (evaluate), Specific Spell Channeling (evaluate), Channel Interruptible (evaluate), Class (evaluate), Unit Classification (evaluate), In Combat (evaluate), Is Dead or Ghost (evaluate), Distance (evaluate), Distance Count (evaluate), Eclipse (evaluate), Extended Character Stat (evaluate), Extended Character Stat Percentage (evaluate), Boss Encounter (evaluate), Hostile (evaluate), Shapeshift Form (evaluate), Is Friendly (evaluate), Glyph (evaluate), In Group (evaluate), Group Count (evaluate), Health (evaluate), Health Percentage (evaluate), Hero Talent Tree (evaluate), In Control (evaluate), Instance (evaluate), Is Same As (evaluate), Mythic+ Keystone Level (evaluate), Loss Of Control Blocked (evaluate), Loss Of Control Type (evaluate), Mana (evaluate), Mana Percentage (evaluate), Raid Mark (evaluate), Raid Mark Count (evaluate), Moving (evaluate), Outdoors (evaluate), Have Pet (evaluate), Pet Spell Active or Pending (evaluate), Pet Spell Available (evaluate), Pet Spell Charges (evaluate), Pet Spell Cooldown (evaluate), Pet Spell Cast History (evaluate), Pet Spell Cast History Time (evaluate), Pet Spell In Range (evaluate), Pet Spell Recharge Time (evaluate), Pet Happiness (evaluate), Have Named Pet (evaluate), Player State (evaluate), Points (evaluate), Power (evaluate), Power Percentage (evaluate), Primary Talent Tree (evaluate), PVP Flagged (evaluate), Raid Role (evaluate), Role (evaluate), Runes (evaluate), Rune Cooldown (evaluate), Spell Active or Pending (evaluate), Spell Auto-Repeat Active (evaluate), Spell Available (evaluate), Spell Charges (evaluate), Spell Cooldown (evaluate), Spell Proc Glow (evaluate), Spell In Range (evaluate), Spell Recharge Time (evaluate), Stagger (evaluate), Character Stat (evaluate), Stealth (evaluate), Weapon Swing Time Remaining (evaluate), Talent (evaluate), Talent Tree Points (evaluate), Threat (evaluate), Unit Exists (evaluate), Zone PVP (evaluate), Conditions.spatial.rangeMember, Conditions.weapon.swingSpeed
Dependencies
getCachedInternal→utils.getCachedInternal
Source
Functions/cache.lua, line 164. Read only in game; Duplicate makes an editable copy.
Functions.cache.getCached(cache, func, ...)
return getCachedInternal(cache, true, func, ...)