68 lines
1.3 KiB
PHP
68 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Exception;
|
|
use Illuminate\Support\Facades\Redis;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\Log;
|
|
/**
|
|
* Class CheckRedisStatus
|
|
*
|
|
* @package App\Console\Commands
|
|
*/
|
|
class CheckRedisStatus extends Command
|
|
{
|
|
|
|
/**
|
|
* The name of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'check:redis';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Check Redis Connection Status';
|
|
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
* @param GameRepository $gameRepo
|
|
* @param WalletService $walletService
|
|
*/
|
|
public function __construct(
|
|
) {
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
try{
|
|
$redis = Redis::connection('cache');
|
|
|
|
if($redis->ping()){
|
|
print_r("pong");
|
|
Log::info("pong");
|
|
}else{
|
|
print_r("Redis Connection Fail");
|
|
Log::critical("Redis Connection Fail");
|
|
}
|
|
|
|
}catch(Exception $e){
|
|
print_r($e->getMessage());
|
|
Log::critical("Redis Connection Fail : ".$e->getMessage());
|
|
}
|
|
|
|
}
|
|
|
|
}
|