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?
We have added a custom RedisManager class which is extending the normal laravel RedisManager class.
And use it as a new singleton:
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?