You've already forked Traefik-Redis-Api
Is there an award for this?
This commit is contained in:
45
src/Facades/RedisClient.php
Normal file
45
src/Facades/RedisClient.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Siteworxpro\App\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Siteworxpro\App\Traefik\EntityEnum;
|
||||
use Siteworxpro\App\Traefik\ProtocolEnum;
|
||||
use Siteworxpro\App\Traefik\RedisClient as RedisClientConcrete;
|
||||
|
||||
/**
|
||||
* Facade for RedisClient.
|
||||
*
|
||||
* This class provides a static interface to the RedisClientConcrete class.
|
||||
*
|
||||
* @method static void createOrReplace(string $name, array $data, EntityEnum $entity, ProtocolEnum $type = ProtocolEnum::HTTP)
|
||||
* @method static bool deleteAllKeys(string $name, EntityEnum $entity, ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
* @method static array getAllMiddlewares(ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
* @method static array getMiddleware(string $name, ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
* @method static array getAllRouters(ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
* @method static array getRouter(string $name, ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
* @method static array getAllServices(ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
* @method static array getService(string $name, ProtocolEnum $protocol = ProtocolEnum::HTTP)
|
||||
*/
|
||||
class RedisClient extends Facade
|
||||
{
|
||||
public static function getFacadeRoot(): RedisClientConcrete
|
||||
{
|
||||
if (self::$resolvedInstance !== null) {
|
||||
$client = self::resolveFacadeInstance(self::getFacadeAccessor());
|
||||
|
||||
if ($client instanceof RedisClientConcrete) {
|
||||
return $client;
|
||||
}
|
||||
}
|
||||
|
||||
return new RedisClientConcrete();
|
||||
}
|
||||
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
return RedisClientConcrete::class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user