eee
This commit is contained in:
@@ -896,6 +896,21 @@ if (!function_exists('trigger_print_error')) {
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('println')) {
|
||||
|
||||
/**
|
||||
* @param mixed $message
|
||||
* @param string $method
|
||||
* @return bool
|
||||
* @throws
|
||||
*/
|
||||
function println(mixed $message, string $method = 'app'): bool
|
||||
{
|
||||
return Kiri::getLogger()->failure($message, $method);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('event')) {
|
||||
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ abstract class BaseApplication extends Component
|
||||
/**
|
||||
* @param $id
|
||||
* @param $definition
|
||||
* @throws Exception
|
||||
*/
|
||||
public function set($id, $definition): void
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ use Exception;
|
||||
use Kiri;
|
||||
use Kiri\Exception\RedisConnectException;
|
||||
use Kiri\Pool\Pool;
|
||||
use function println;
|
||||
|
||||
/**
|
||||
* Class Redis
|
||||
@@ -72,11 +73,10 @@ class Redis
|
||||
public function __call($name, $arguments): mixed
|
||||
{
|
||||
if (method_exists($this, $name)) {
|
||||
$data = $this->{$name}(...$arguments);
|
||||
return $this->{$name}(...$arguments);
|
||||
} else {
|
||||
$data = $this->proxy($name, $arguments);
|
||||
return $this->proxy($name, $arguments);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,12 +150,12 @@ SCRIPT;
|
||||
{
|
||||
$client = $this->getClient();
|
||||
try {
|
||||
$response = $client->{$name}(...$arguments);
|
||||
return $client->{$name}(...$arguments);
|
||||
} catch (\Throwable $throwable) {
|
||||
$response = trigger_print_error($throwable, 'redis');
|
||||
return trigger_print_error(throwable($throwable));
|
||||
} finally {
|
||||
$this->pool()->push($this->host, $client);
|
||||
}
|
||||
$this->pool()->push($this->host, $client);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user