PHP 클래스 Predis\Cluster\Distributor\HashRing

저자: Daniele Alessandri ([email protected])
저자: Lorenzo Castelli ([email protected])
상속: implements Predis\Cluster\Distributor\DistributorInterface, implements Predis\Cluster\Hash\HashGeneratorInterface
파일 보기 프로젝트 열기: tillkruss/redis-object-cache 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( integer $replicas = self::DEFAULT_REPLICAS, mixed $nodeHashCallback = null )
add ( mixed $node, integer $weight = null ) Adds a node to the ring with an optional weight.
get ( $value )
getByHash ( $hash )
getBySlot ( $slot )
getHashGenerator ( )
getSlot ( $hash )
hash ( $value )
remove ( $node )

보호된 메소드들

메소드 설명
addNodeToRing ( array &$ring, mixed $node, integer $totalNodes, integer $replicas, float $weightRatio ) Implements the logic needed to add a node to the hashring.
getNodeHash ( $nodeObject )
wrapAroundStrategy ( integer $upper, integer $lower, integer $ringKeysCount ) : integer Implements a strategy to deal with wrap-around errors during binary searches.

비공개 메소드들

메소드 설명
computeTotalWeight ( ) : integer Calculates the total weight of all the nodes in the distributor.
initialize ( ) Initializes the distributor.
isInitialized ( ) : boolean Returns the initialization status of the distributor.
reset ( ) Resets the distributor.

메소드 상세

__construct() 공개 메소드

public __construct ( integer $replicas = self::DEFAULT_REPLICAS, mixed $nodeHashCallback = null )
$replicas integer Number of replicas in the ring.
$nodeHashCallback mixed Callback returning a string used to calculate the hash of nodes.

add() 공개 메소드

Adds a node to the ring with an optional weight.
public add ( mixed $node, integer $weight = null )
$node mixed Node object.
$weight integer Weight for the node.

addNodeToRing() 보호된 메소드

Implements the logic needed to add a node to the hashring.
protected addNodeToRing ( array &$ring, mixed $node, integer $totalNodes, integer $replicas, float $weightRatio )
$ring array Source hashring.
$node mixed Node object to be added.
$totalNodes integer Total number of nodes.
$replicas integer Number of replicas in the ring.
$weightRatio float Weight ratio for the node.

get() 공개 메소드

public get ( $value )

getByHash() 공개 메소드

public getByHash ( $hash )

getBySlot() 공개 메소드

public getBySlot ( $slot )

getHashGenerator() 공개 메소드

public getHashGenerator ( )

getNodeHash() 보호된 메소드

protected getNodeHash ( $nodeObject )

getSlot() 공개 메소드

public getSlot ( $hash )

hash() 공개 메소드

public hash ( $value )

remove() 공개 메소드

public remove ( $node )

wrapAroundStrategy() 보호된 메소드

Implements a strategy to deal with wrap-around errors during binary searches.
protected wrapAroundStrategy ( integer $upper, integer $lower, integer $ringKeysCount ) : integer
$upper integer
$lower integer
$ringKeysCount integer
리턴 integer