function getBucketMemcache()
{
+ static $m;
+
if (!CONST_ConnectionBucket_MemcacheServerAddress) return null;
- $m = new Memcached();
- $m->addServer(CONST_ConnectionBucket_MemcacheServerAddress, CONST_ConnectionBucket_MemcacheServerPort);
+ if (!isset($m))
+ {
+ $m = new Memcached();
+ $m->addServer(CONST_ConnectionBucket_MemcacheServerAddress, CONST_ConnectionBucket_MemcacheServerPort);
+ }
return $m;
}
return $iMaxVal;
}
+ function byLastBlockTime($a, $b)
+ {
+ if ($a['lastBlockTimestamp'] == $b['lastBlockTimestamp'])
+ {
+ return 0;
+ }
+ return ($a['lastBlockTimestamp'] > $b['lastBlockTimestamp']) ? -1 : 1;
+ }
+
function getBucketBlocks()
{
$m = getBucketMemcache();
'currentlyBlocked' => $iCurrentBucketSize + (CONST_ConnectionBucket_Cost_Reverse) >= CONST_ConnectionBucket_BlockLimit,
);
}
+ uasort($aBlockedList, 'byLastBlockTime');
return $aBlockedList;
}