PHP Class Predis\Cluster\SlotMap

Inheritance: implements ArrayAccess, implements IteratorAggregate, implements Countable
Datei anzeigen Open project: nrk/predis Class Usage Examples

Public Methods

Method Description
count ( ) : integer Returns the current number of assigned slots.
getIterator ( ) : ArrayIterator Returns an iterator over the slot map.
getNodes ( ) : array Returns the list of unique nodes in the slot map.
getSlots ( integer $first, integer $last ) : array Returns the specified slot range.
isEmpty ( ) : boolean Checks if the slot map is empty.
isValid ( $slot ) : boolean Checks if the given slot is valid.
isValidRange ( integer $first, integer $last ) : boolean Checks if the given slot range is valid.
offsetExists ( integer $slot ) : boolean Checks if the specified slot is assigned.
offsetGet ( integer $slot ) : string Returns the node assigned to the specified slot.
offsetSet ( integer $slot, NodeConnectionInterface | string $connection ) : string Assigns the specified slot to a node.
offsetUnset ( integer $slot ) : string Returns the node assigned to the specified slot.
reset ( ) Resets the slot map.
setSlots ( integer $first, integer $last, NodeConnectionInterface | string $connection ) Assigns the specified slot range to a node.
toArray ( ) : array Returns the current slot map as a dictionary of $slot => $node.

Method Details

count() public method

Returns the current number of assigned slots.
public count ( ) : integer
return integer

getIterator() public method

Returns an iterator over the slot map.

getNodes() public method

Returns the list of unique nodes in the slot map.
public getNodes ( ) : array
return array

getSlots() public method

Returns the specified slot range.
public getSlots ( integer $first, integer $last ) : array
$first integer Initial slot of the range.
$last integer Last slot of the range.
return array

isEmpty() public method

Checks if the slot map is empty.
public isEmpty ( ) : boolean
return boolean

isValid() public static method

Checks if the given slot is valid.
public static isValid ( $slot ) : boolean
return boolean

isValidRange() public static method

Checks if the given slot range is valid.
public static isValidRange ( integer $first, integer $last ) : boolean
$first integer Initial slot of the range.
$last integer Last slot of the range.
return boolean

offsetExists() public method

Checks if the specified slot is assigned.
public offsetExists ( integer $slot ) : boolean
$slot integer Slot index.
return boolean

offsetGet() public method

Returns the node assigned to the specified slot.
public offsetGet ( integer $slot ) : string
$slot integer Slot index.
return string

offsetSet() public method

Assigns the specified slot to a node.
public offsetSet ( integer $slot, NodeConnectionInterface | string $connection ) : string
$slot integer Slot index.
$connection NodeConnectionInterface | string ID or connection instance.
return string

offsetUnset() public method

Returns the node assigned to the specified slot.
public offsetUnset ( integer $slot ) : string
$slot integer Slot index.
return string

reset() public method

Resets the slot map.
public reset ( )

setSlots() public method

Assigns the specified slot range to a node.
public setSlots ( integer $first, integer $last, NodeConnectionInterface | string $connection )
$first integer Initial slot of the range.
$last integer Last slot of the range.
$connection NodeConnectionInterface | string ID or connection instance.

toArray() public method

The order of the slots in the dictionary is not guaranteed.
public toArray ( ) : array
return array