Nevermore
            (Nevermore1989)
          
          
          
              
              
          1
          
         
        
          
$redis = new \Redis();
$redis->connect('localhost','9002');
$redis->select(0);
$redis->setOption(\Redis::OPT_PREFIX,'myprefix');
$redis->hmset('key',['name'=>'joe','salary'=>2000]);
How to use redis->hmset with yii2/redis like above?
The following code does not work!
'components' => [
            'redis'=>[
                'class'=>'yii\redis\Connection',
                'hostname'=>'127.0.0.1',
                'port' => 9002,
                'database' => 1,
            ],
        ],
\Yii::$app->redis->hmset('key',['name'=>'joe','salary'=>2000]);
         
        
          
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            samdark
            (Alexander Makarov)
          
          
          
              
              
          2
          
         
        
          How exactly it does not work?
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            Nevermore
            (Nevermore1989)
          
          
          
              
              
          3
          
         
        
          
\Yii::$app->redis->hmset('key',['name'=>'joe','salary'=>2000]);
PHP Warning – yii\base\ErrorException
mb_strlen() expects parameter 1 to be string, array given
yii\redis\Connection line 357
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            drmovi
            (Drmovi)
          
          
          
              
              
          4
          
         
        
          simply serialize your array
\Yii::$app->redis->hmset('key',serialize(['name'=>'joe','salary'=>2000]));
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            Nevermore
            (Nevermore1989)
          
          
          
              
              
          5
          
         
        
          
If the array is serialized,how can I get the value by using
$redis->hmGet('key', array('name'));