Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by im
Why isn't there a function to check if a cache id is valid? So you could do:
pawn Код:
if(is_valid_cache(cache_id[playerid) { cache_set_active(cache_id[playerid]); } else { // run a query to get the data. }
That is useful for dialogs. I use dialogs for in game messages, so when a player uses the command /pms he sees a list dialog with latest recived messages and from there he can click a message to read it. So when the player types /emails, I save all the data using cache_save() and if the player clicks a message, I just use the cached data to show the message to the player, without running the query agains. When the player clicks back he returns to the /pms command and the script checks if the player has anything stored in the cache or not. If there is data stored in the cache for that player, the script loads the data from the cache, if not, it runs a query to get the data.
|
It should be no problem to add a native like "cache_is_valid(Cache:id);". You can track the current status of R35 here:
http://git.my-reallife.de/root/mysql...a/commits/beta