Thread:Project:Support desk/Daily Random Tag Extension/reply

Well if you don't care super much about it being precisely once a day, and are using some sort of caching [this only works if you have caching enabled], you could store it in cache with expiry of 24 hours (of course, expiry of 24 hours means at most 24 hours, things can get kicked out of cache earlier if out of room) using $wgMemc. You'd have code that looks like: // all this inside whatever function you have global $wgMemc; // To get the key under which things are stored under (key is a unique identifier for the cached item): $key = wfMemcKey( 'extension-name', 'name-of-specific-item-being-stored (for example the current page name if you store 1 thing per page)' ); // To get the value for the thing stored under $key (returns false if doesn't exist) $wgMemc->get( $key ); // To set a value (lets call the value $value) for the key // 24*60*60 = number of seconds in 1 day $wgMemc->set( $key, $value, 24*60*60 );

Alternatively, you would have to create your own db table (see Manual:Hooks/LoadExtensionSchemaUpdates for how to integrate with updater), and store stuff in that table, along with expiry times and what not, which is a bit more complicated. (but possibly more "correct" since the cache makes no guarantee on how long it will store stuff).

As an aside, you might want to call $parser->getOutput->updateCacheExpiry( 24*60*60 ); From your tag extension - which says do not cache the html from rendering this page for more then 24 hours.