This commit is contained in:
2023-11-23 16:33:06 +08:00
parent d30df26cc8
commit 396248e41e
3 changed files with 23 additions and 7 deletions
@@ -158,6 +158,7 @@ abstract class BaseApplication extends Component
/**
* @param $id
* @param $definition
* @throws Exception
*/
public function set($id, $definition): void
{
+7 -7
View File
@@ -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;
}