itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.69k stars 321 forks source link

Laravel custom RedisManager not picking up events #648

Closed MartijnBastiaansen closed 1 year ago

MartijnBastiaansen commented 1 year ago

We have added a custom RedisManager class which is extending the normal laravel RedisManager class.

<?php

namespace App\Redis;

use Illuminate\Redis\RedisManager;

class RedisCacheManager extends RedisManager
{
}

And use it as a new singleton:

<?php

namespace App\Redis\Providers;

use App\Redis\RedisCacheManager;
use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;

class RedisCacheServiceProvider extends ServiceProvider implements DeferrableProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register(): void
    {
        $this->app->singleton(RedisCacheManager::class, function ($app) {
            $config = $app->make('config')->get('database.redis', []);

            return new RedisCacheManager($app, Arr::pull($config, 'client', 'phpredis'), $config);
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides(): array
    {
        return [RedisCacheManager::class];
    }
}

The normal RedisManager is working correctly, but our own RedisCacheManager doesn't report any calls to Redis. Is there a way to let our own manager report the calls to Redis to?