cmbYouku_Api/app/service/util/RedisService.php

23 lines
477 B
PHP
Raw Permalink Normal View History

2024-07-01 15:57:07 +08:00
<?php
namespace app\service\util;
use Predis\Client;
class RedisService
{
protected static $client;
public static function getRedisInstance(): Client
{
if(!self::$client){
self::$client = new Client([
'scheme'=>'tcp',
'host' => env('redis.host'),
'port' => env('redis.port'),
'password'=>env('redis.password')
]);
}
return self::$client;
}
}