/** @var Array (location => (start, end)) */
protected $liveRing;
/** @var Array (location => UNIX timestamp) */
/** @var Array (location => (start, end)) */
protected $liveRing;
/** @var Array (location => UNIX timestamp) */
foreach ( $map as $location => $weight ) {
$standardMap[$location] = (int)floor( $weight / $sum * self::RING_SIZE );
}
foreach ( $map as $location => $weight ) {
$standardMap[$location] = (int)floor( $weight / $sum * self::RING_SIZE );
}
$index = 0;
foreach ( $standardMap as $location => $weight ) {
// Location covers half-closed interval [$index,$index + $weight)
$index = 0;
foreach ( $standardMap as $location => $weight ) {
// Location covers half-closed interval [$index,$index + $weight)
* @return array List of locations
*/
public function getLocations( $item, $limit ) {
* @return array List of locations
*/
public function getLocations( $item, $limit ) {
$primaryLocation = null;
$spot = hexdec( substr( sha1( $item ), 0, 7 ) ); // first 28 bits
foreach ( $this->ring as $location => $range ) {
$primaryLocation = null;
$spot = hexdec( substr( sha1( $item ), 0, 7 ) ); // first 28 bits
foreach ( $this->ring as $location => $range ) {
$this->ejectionNextExpiry = min( $this->ejectionExpiries );
} else { // common case; avoid recalculating ring
$this->liveRing = clone $this;
$this->ejectionNextExpiry = min( $this->ejectionExpiries );
} else { // common case; avoid recalculating ring
$this->liveRing = clone $this;