View Single Post
04-30-18, 11:29 PM   #11
Edik
A Murloc Raider
 
Edik's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 5
I must agree with most notes here. I found falw in my code. In fact it didn't cahe at all if query didn't hit exactly same aura. I fix it by:

Lua Code:
  1. if cache and cache[key] and cache[key]['stamp'] == ("%.1f"):format(GetTime()) then -- cached values updated 10 times per second
  2.       if cache[key][index] then retTable = cache[key][index] else retTable = {} end
  3.     else -- fetch new cached values

now it is really effective and overhead is small if multiple aura checks by name are done in one cycle (in split .1s). Keep in mind these wrappers are just for time period when code need to be 7.x compatible and you want to do just small or none changes for testing in 8.x. These functions aren't permanent for 8.x. I'm pretty sure that someone come with new UnitAUra, UnitBuff and UnitDebuff for quering aura by Name. BTW someone told about UnitAura doesn't support query by Name in 7.x I must disagree it does support. Form is UnitAura(unit,name[,[nameSubtext][,filter]]).

Last edited by Edik : 04-30-18 at 11:57 PM.
  Reply With Quote