We can use below commands in laravel.
$user = Redis::get('user:profile:'.$id);
$values = Redis::lrange('names', 5, 10);
$values = Redis::command('lrange', ['name', 5, 10]);
but can’t use memory usage keyname
command with laravel redis facade.
We can use below commands in laravel.
$user = Redis::get('user:profile:'.$id);
$values = Redis::lrange('names', 5, 10);
$values = Redis::command('lrange', ['name', 5, 10]);
but can’t use memory usage keyname
command with laravel redis facade.
2
Answers
Short answer no you can’t execute. Let me explain;
this method is used when you invoke methods and it uses this abstract method to decide whether you can invoke a method or not.
getSupportedCommands
method looks like this;memory usage
command is not available in this method. You may check/vendor/predis/predis/src/Profile/RedisVersion300.php
or any other class inProfile
folder – it is not defined in there.The reason is
memory usage
method is available since Redis version4.0.0
. This package is supporting commands until Redis version3.0.0
as it can be seen from class names such asRedisVersion240
,RedisVersion300
etc.The command is not defined for that, but you can use eval:
Or if you want to use the keyname as a paramater:
Redis LUA scripts are executed the same way in laravel