public function exec()
    {
        if (true === $this->multi) {
            $ret         = array();
            $this->multi = false;
            // exec
            foreach ($this->execList as $todos) {
                $redis = $todos[0]['redis']; // ^^ not so secure ?
                $this->notifyEvent('multi', array());
                $redis->multi();
                foreach ($todos as $todo) {
                    if ($todo['function'] instanceof \Closure) {
                        $ret[] = $todo['function']($redis);
                    } else {
                        throw new Exception("Ce n'est pas une Closure !");
                    }
                }
                $this->notifyEvent('exec', array());
                $redis->exec();
            }
            $this->execList = array(); // purge the execList

            return $ret;
        } else {
            throw new Exception("you have to call multi before exec");
        }
    }
public function exec()
    {
        if (true === $this->multi) {
            $ret         = array();
            $this->multi = false;
            // exec
            foreach ($this->execList as $todos) {
                $redis = $todos[0]['redis']; // ^^ not so secure ?
                $this->notifyEvent('multi', array());
                $redis->multi();
                foreach ($todos as $todo) {
                    if ($todo['function'] instanceof \Closure) {
                        $ret[] = $todo['function']($redis);
                    } else {
                        throw new Exception("Ce n'est pas une Closure !");
                    }
                }
                $this->notifyEvent('exec', array());
                $redis->exec();
            }
            $this->execList = array(); // purge the execList

            return $ret;
        } else {
            throw new Exception("you have to call multi before exec");
        }
    }
public function exec ( ) { if ( true === $ this -> multi ) { $ ret = array ( ) ; $ this -> multi = false ; // exec foreach ( $ this -> execList as $ todos ) { $ redis = $ todos [ 0 ] [ 'redis' ] ; // ^^ not so secure ? $ this -> notifyEvent ( 'multi' , array ( ) ) ; $ redis -> multi ( ) ; foreach ( $ todos as $ todo ) { if ( $ todo [ 'function' ] instanceof \ Closure ) { $ ret [ ] = $ todo [ 'function' ] ( $ redis ) ; } else { throw new Exception ( "Ce n'est pas une Closure !" ) ; } } $ this -> notifyEvent ( 'exec' , array ( ) ) ; $ redis -> exec ( ) ; } $ this -> execList = array ( ) ; // purge the execList return $ ret ; } else { throw new Exception ( "you have to call multi before exec" ) ; } }
execute multiple commands

@throws Exception
@return array outputs of the commands
execute multiple commands