2016-11-08 27 views
0

私はを使用していますyiisoft/yii2-redis Yii2コン​​ポーネントはRedisとやりとりするためにデータを取得する際には魅力的ですが、私はコマンドのようなセットを使用しようとしています!Redisエラー 'hmset'の引数が間違っています

Redis error: ERR wrong number of arguments for 'hmset' command 
Redis command was: hmset userApi:57d120d1d13f4a3e4d1e2217 rateLimit 10 allowance 9 allowance_updated_at 1478594580 

Redis error: ERR wrong number of arguments for 'set' command 
Redis command was: set x 10 

私のコードは単純です:

$redis = Yii::$app->redis; 
$redis->hmset('userApi:57d120d1d13f4a3e4d1e2217 rateLimit 10 allowance 9 allowance_updated_at 1478594580'); 
$redis->set('x 10'); 

私はちょうどこれらのコマンドのいずれかをコピーして貼り付けるとき、それはRedisの-cliをすることそれだけで作品に注目します!

何か不足している手がかりはありますか?前もって感謝します。

答えて

0

おっと!私の欠陥私は、redisコマンドparamsがコマンド機能の引数として次のように渡されるべきであることが分かった:

$redis->hmset('userApi:57d120d1d13f4a3e4d1e2217', 'rateLimit', '10', 'allowance', '9', 'allowance_updated_at', '1478594580'); 
$redis->set('x', '10'); 
関連する問題