MediaWiki REL1_33
HashSiteStore.php
Go to the documentation of this file.
1<?php
32class HashSiteStore implements SiteStore {
33
37 private $sites = [];
38
42 public function __construct( $sites = [] ) {
43 $this->saveSites( $sites );
44 }
45
55 public function saveSite( Site $site ) {
56 $this->sites[$site->getGlobalId()] = $site;
57
58 return true;
59 }
60
70 public function saveSites( array $sites ) {
71 foreach ( $sites as $site ) {
72 $this->saveSite( $site );
73 }
74
75 return true;
76 }
77
89 public function getSite( $globalId, $source = 'cache' ) {
90 return $this->sites[$globalId] ?? null;
91 }
92
105 public function getSites( $source = 'cache' ) {
106 return new SiteList( $this->sites );
107 }
108
114 public function clear() {
115 $this->sites = [];
116
117 return true;
118 }
119
120}
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
In-memory SiteStore implementation, storing sites in an associative array.
saveSite(Site $site)
Saves the provided site.
getSite( $globalId, $source='cache')
Returns the site with provided global id, or null if there is no such site.
__construct( $sites=[])
saveSites(array $sites)
Saves the provided sites.
clear()
Deletes all sites from the database.
getSites( $source='cache')
Returns a list of all sites.
Definition Site.php:29
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))
$source