public function setKeyDistributor($name)
    {
        $this->_options['keyDistributor'] = $name;

        if (is_object($name)) {
            $this->_keyDistributor = $name;
        } else if (in_array($name, array('crc32', 'consistentHashing'))) {
            $name = ucfirst($name);
            $className = "Rediska_KeyDistributor_$name";
            $this->_keyDistributor = new $className;
        } else {
            if (!@class_exists($name)) {
                throw new Rediska_Exception("Key distributor '$name' not found. You need include it before or setup autoload.");
            }
            $this->_keyDistributor = new $name;
        }

        if (!$this->_keyDistributor instanceof Rediska_KeyDistributor_Interface) {
            throw new Rediska_Exception("'$name' must implement Rediska_KeyDistributor_Interface");
        }

        // Add available connections
        foreach($this->_connections as $connectionString => $connection) {
            $this->_keyDistributor->addConnection($connectionString);
        }

        return $this;
    }
public function setKeyDistributor($name)
    {
        $this->_options['keyDistributor'] = $name;

        if (is_object($name)) {
            $this->_keyDistributor = $name;
        } else if (in_array($name, array('crc32', 'consistentHashing'))) {
            $name = ucfirst($name);
            $className = "Rediska_KeyDistributor_$name";
            $this->_keyDistributor = new $className;
        } else {
            if (!@class_exists($name)) {
                throw new Rediska_Exception("Key distributor '$name' not found. You need include it before or setup autoload.");
            }
            $this->_keyDistributor = new $name;
        }

        if (!$this->_keyDistributor instanceof Rediska_KeyDistributor_Interface) {
            throw new Rediska_Exception("'$name' must implement Rediska_KeyDistributor_Interface");
        }

        // Add available connections
        foreach($this->_connections as $connectionString => $connection) {
            $this->_keyDistributor->addConnection($connectionString);
        }

        return $this;
    }
public function setKeyDistributor ( $ name ) { $ this -> _options [ 'keyDistributor' ] = $ name ; if ( is_object ( $ name ) ) { $ this -> _keyDistributor = $ name ; } else if ( in_array ( $ name , array ( 'crc32' , 'consistentHashing' ) ) ) { $ name = ucfirst ( $ name ) ; $ className = "Rediska_KeyDistributor_$name" ; $ this -> _keyDistributor = new $ className ; } else { if ( ! @ class_exists ( $ name ) ) { throw new Rediska_Exception ( "Key distributor '$name' not found. You need include it before or setup autoload." ) ; } $ this -> _keyDistributor = new $ name ; } if ( ! $ this -> _keyDistributor instanceof Rediska_KeyDistributor_Interface ) { throw new Rediska_Exception ( "'$name' must implement Rediska_KeyDistributor_Interface" ) ; } // Add available connections foreach ( $ this -> _connections as $ connectionString => $ connection ) { $ this -> _keyDistributor -> addConnection ( $ connectionString ) ; } return $ this ; }
Set key distributor.
See options description for more information.

@throws Rediska_Exception
@param string $name Object or name of key distributor (crc32, consistentHashing or you personal class)
@return rediska
Set key distributor . See options description for more information .