本文整理汇总了PHP中SquidUpdate::ScribePurge方法的典型用法代码示例。如果您正苦于以下问题:PHP SquidUpdate::ScribePurge方法的具体用法?PHP SquidUpdate::ScribePurge怎么用?PHP SquidUpdate::ScribePurge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SquidUpdate
的用法示例。
在下文中一共展示了SquidUpdate::ScribePurge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: purge
/**
* Purges a list of Squids defined in $wgSquidServers.
* $urlArr should contain the full URLs to purge as values
* (example: $urlArr[] = 'http://my.host/something')
* XXX report broken Squids per mail or log
*
* @param $urlArr array
* @return void
*/
static function purge($urlArr)
{
global $wgSquidServers, $wgHTCPMulticastAddress, $wgHTCPPort;
/*if ( (@$wgSquidServers[0]) == 'echo' ) {
echo implode("<br />\n", $urlArr) . "<br />\n";
return;
}*/
if (!$urlArr) {
return;
}
// wikia change start
global $wgPurgeSquidViaScribe;
if ($wgPurgeSquidViaScribe == true) {
SquidUpdate::ScribePurge($urlArr);
return;
}
// wikia change end
if ($wgHTCPMulticastAddress && $wgHTCPPort) {
SquidUpdate::HTCPPurge($urlArr);
}
wfProfileIn(__METHOD__);
$maxSocketsPerSquid = 8;
// socket cap per Squid
$urlsPerSocket = 400;
// 400 seems to be a good tradeoff, opening a socket takes a while
$socketsPerSquid = ceil(count($urlArr) / $urlsPerSocket);
if ($socketsPerSquid > $maxSocketsPerSquid) {
$socketsPerSquid = $maxSocketsPerSquid;
}
$pool = new SquidPurgeClientPool();
$chunks = array_chunk($urlArr, ceil(count($urlArr) / $socketsPerSquid));
foreach ($wgSquidServers as $server) {
foreach ($chunks as $chunk) {
$client = new SquidPurgeClient($server);
foreach ($chunk as $url) {
$client->queuePurge($url);
}
$pool->addClient($client);
}
}
$pool->run();
wfProfileOut(__METHOD__);
}