WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Problems with forcing cache entries (https://www.wowinterface.com/forums/showthread.php?t=19028)

Kjado 10-31-08 01:19 PM

Problems with forcing cache entries
 
I wrote a small addon to add some inscription information to tooltips:
http://www.wowinterface.com/download...rindstone.html

I have my association tables implemented via item IDs instead of names to provide cross-localization support automatically. However, by doing this I need to force all of the inscription-related items (herbs, pigments, and inks) from my tables into the user's cache so later calls to GetItemInfo() do not return nil. After doing some research, I found that the following will force an item into the cache:
Code:

tooltip:SetHyperlink("item:" .. id)
I step through and do this for all of the items I care about for my addon, however, with a fresh cache (by deleting the Cache folder before starting WoW), GetItemInfo() returns nil later in the addon loading stage, even though I am sure to only call it with arguments I know are valid from my tables. The interesting thing is, if I reload the UI via /console reloadui, etc. a couple times immediately afterwards, the errors cease and the addon works properly.

Is there some sort of delay on cache entries that would cause these first couple startup iterations to not find the items in the cache even though they had been set via GameTooltip:SetHyperlink()? Or if this isn't the case, is there a more effective way to force data into the cache for later use?

Cirk 10-31-08 04:37 PM

Quote:

Originally Posted by Kjado (Post 107600)
I step through and do this for all of the items I care about for my addon, however, with a fresh cache (by deleting the Cache folder before starting WoW), GetItemInfo() returns nil later in the addon loading stage, even though I am sure to only call it with arguments I know are valid from my tables. The interesting thing is, if I reload the UI via /console reloadui, etc. a couple times immediately afterwards, the errors cease and the addon works properly.

Although SetHyperlink will cause the item to be loaded into your local cache, this takes time since it requires a request to the server and response back. Also, apparently the cache is of limited size, so items will "age out" of the cache over time, meaning even if the item is in the cache today, it may not be tomorrow.

What I do for this problem in Lootvalue (which faces similar problems to your addon) is just to keep retrying every 200msec (via OnUpdate) while the tooltip is shown to see if we have the data yet.

(I use 200msec since for most players that means one retry cycle, and 200msec is the Blizz default tooltip update delay anyway).

Hope that helps
-- Cirk


All times are GMT -6. The time now is 12:38 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI