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')) {
|
if (!function_exists('event')) {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ abstract class BaseApplication extends Component
|
|||||||
/**
|
/**
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param $definition
|
* @param $definition
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function set($id, $definition): void
|
public function set($id, $definition): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use Exception;
|
|||||||
use Kiri;
|
use Kiri;
|
||||||
use Kiri\Exception\RedisConnectException;
|
use Kiri\Exception\RedisConnectException;
|
||||||
use Kiri\Pool\Pool;
|
use Kiri\Pool\Pool;
|
||||||
|
use function println;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Redis
|
* Class Redis
|
||||||
@@ -72,11 +73,10 @@ class Redis
|
|||||||
public function __call($name, $arguments): mixed
|
public function __call($name, $arguments): mixed
|
||||||
{
|
{
|
||||||
if (method_exists($this, $name)) {
|
if (method_exists($this, $name)) {
|
||||||
$data = $this->{$name}(...$arguments);
|
return $this->{$name}(...$arguments);
|
||||||
} else {
|
} else {
|
||||||
$data = $this->proxy($name, $arguments);
|
return $this->proxy($name, $arguments);
|
||||||
}
|
}
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,12 +150,12 @@ SCRIPT;
|
|||||||
{
|
{
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
try {
|
try {
|
||||||
$response = $client->{$name}(...$arguments);
|
return $client->{$name}(...$arguments);
|
||||||
} catch (\Throwable $throwable) {
|
} 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