23 lines
477 B
PHP
23 lines
477 B
PHP
<?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;
|
|
}
|
|
} |