Laravel uses transaction wrapper of predis, which not implemented in "phpredis service provider"
Sep 1, 2015
4
Level 1
Php artisan queue:listen throws "Call to undefined method Redis::transaction()" with phpredis
Hello everyone,
This is my first post so let me know if I can provide more info.
I use :
- laravel 5.0.33
- phpredis
- phpredis service provider found here : https://github.com/vetruvet/laravel-phpredis
I have the following configuration :
In app.php
Providers
'App\MyProviders\PhpRedisServiceProvide'
Aliases
'PhpRedis' => 'Illuminate\Support\Facades\Redis',
In queue.php
'redis' => [
'driver' => 'redis',
'queue' => 'default',
'connection' => 'default',
'expire' => 60,
],
In database.php
'redis' => [
'cluster' => false,
'default' => [
'host' => '192.168.33.100',
'port' => 6379,
'prefix' => '',
'database' => 0,
'timeout' => 0,
'serializer' => 'igbinary',
'persistent' => false
],
Jobs are pushed successfully in queues but when I try to start a queue, I get the following error :
$ php artisan queue:listen --queue=images --tries=3
PHP Fatal error: Call to undefined method Redis::transaction() in /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php on line 179
[2015-08-31 20:04:49] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Redis::transaction()' in /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php:179 Stack trace:
#0 {main}
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Redis::transaction()
The following code works :
$redis = PhpRedis::connection();
$redis->set('name', 'Dave');
$name = $redis->get('name');
Cache::forever('name', 'Dave');
$name = Cache::get('name');
Queue::push('MyService@test', array(
'test' => 'content'
), 'myqueue');
Thank you for the help.
Level 1
Please or to participate in this conversation.