i'm using yiisoft/yii2-redis Yii2 component to interact with Redis and it's working as charm when it comes to retrieving data but i keep getting the following error as i'm trying to use any set like commands!
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
My code is simply:
$redis = Yii::$app->redis;
$redis->hmset('userApi:57d120d1d13f4a3e4d1e2217 rateLimit 10 allowance 9 allowance_updated_at 1478594580');
$redis->set('x 10');
noting that when i just copy any of these commands and paste it to redis-cli it just works!
Is there any clues that i'm missing something?! thanks in advance.
Oops! my fault i found that redis command params should be passed as arguments to the command function as follows:
$redis->hmset('userApi:57d120d1d13f4a3e4d1e2217', 'rateLimit', '10', 'allowance', '9', 'allowance_updated_at', '1478594580');
$redis->set('x', '10');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With