25 $this->wanCache = MediaWikiServices::getInstance()->getMainWANObjectCache();
37 return $this->wanCache->getWithSetCallback(
40 function ( $oldValue, &$ttl,
array &$setOpts ) use (
$fname ) {
42 $setOpts += Database::getCacheSetOptions(
$dbr );
44 return $dbr->selectFieldValues(
47 [
'page_namespace' => NS_GADGET_DEFINITION ],
52 'checkKeys' => [ $key ],
53 'pcTTL' => WANObjectCache::TTL_PROC_SHORT,
63 if ( $target->
inNamespace( NS_GADGET_DEFINITION ) ) {
72 if ( $target->
inNamespace( NS_GADGET_DEFINITION ) ) {
81 if ( $target->
inNamespace( NS_GADGET_DEFINITION ) ) {
101 $gadget = $this->wanCache->getWithSetCallback(
104 function ( $old, &$ttl,
array &$setOpts ) use ( $id ) {
106 $title = Title::makeTitleSafe( NS_GADGET_DEFINITION, $id );
108 $ttl = WANObjectCache::TTL_UNCACHEABLE;
114 $ttl = WANObjectCache::TTL_UNCACHEABLE;
121 $ttl = WANObjectCache::TTL_UNCACHEABLE;
128 'checkKeys' => [ $key ],
129 'pcTTL' => WANObjectCache::TTL_PROC_SHORT,
134 if ( $gadget ===
null ) {
135 throw new InvalidArgumentException(
"No gadget registered for '$id'" );
154 return $this->wanCache->makeKey(
'gadgets',
'namespace',
'ids' );
162 return $this->wanCache->makeKey(
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
GadgetRepo implementation where each gadget has a page in the Gadget definition namespace,...
handlePageDeletion(LinkTarget $target)
@inheritDoc
const CACHE_TTL
How long in seconds the list of gadget ids and individual gadgets should be cached for (1 day)
getGadgetIds()
Get a list of gadget ids from cache/database.
handlePageCreation(LinkTarget $target)
@inheritDoc
purgeGadgetEntry( $id)
Update the cache for a specific Gadget whenever it is updated.
purgeGadgetIdsList()
Purge the list of gadget ids when a page is deleted or if a new page is created.
handlePageUpdate(LinkTarget $target)
@inheritDoc
const GADGET_CLASS_VERSION
Increment this when changing class structure.
static newFromDefinitionContent( $id, GadgetDefinitionContent $content)
Create a object based on the metadata in a GadgetDefinitionContent object.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
Multi-datacenter aware caching interface.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))