Predis\Cluster\ClusterStrategy::checkSameSlotForKeys PHP Method

checkSameSlotForKeys() protected method

Checks if the specified array of keys will generate the same hash.
protected checkSameSlotForKeys ( array $keys ) : boolean
$keys array Array of keys.
return boolean
    protected function checkSameSlotForKeys(array $keys)
    {
        if (!($count = count($keys))) {
            return false;
        }
        $currentSlot = $this->getSlotByKey($keys[0]);
        for ($i = 1; $i < $count; ++$i) {
            $nextSlot = $this->getSlotByKey($keys[$i]);
            if ($currentSlot !== $nextSlot) {
                return false;
            }
            $currentSlot = $nextSlot;
        }
        return true;
    }