2010/4/8 Prince Gerald Albert - ERS, HCL Tech <[email protected]>:
> Hi Geeks,
>
> I want to know the best option to store a application wide setting / options 
> in mediawiki for an custom developed extension.
>
> Say for example in my extension I need to create a global variable, if it 
> does not exists and reuse it.
>
> I can't keep this in Localsettings.php file, since I need to generate on the 
> fly (once) and use it throughout the application
>
> Right now it is one option and I may require to create multiple options and 
> use it, please guide me or give some links to go through
>
Do you need the variable to be application-wide and persists over
multiple requests? In that case, you could store it in the cache; it's
not technically guaranteed to last but it'll be pretty solid on most
setups.

global $wgMemc;
// to set
$wgMemc->set( wfMemcKey( 'yourKeyHere', 'maybeWithAParameter', 'orTwo'
), 'value' ); // Optional third param: expiry time in seconds

// to get, returns false if not set
$var = $wgMemc->get( wfMemcKey( 'yourKeyHere', 'maybeWithAParameter',
'orTwo' ) );

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to