get(PoolRedis::class); $config = $this->get_config(); $length = Config::get('connections.pool.max', 10); $this->eventProvider->on(OnWorkerExit::class, [$this, 'destroy'], 0); $connections->initConnections('Redis:' . $config['host'], true, $length); } /** * @param $name * @param $arguments * @return mixed * @throws */ public function __call($name, $arguments): mixed { $time = microtime(true); if (method_exists($this, $name)) { $data = $this->{$name}(...$arguments); } else { $data = $this->proxy()->{$name}(...$arguments); $this->release(); } if (microtime(true) - $time >= 0.02) { $this->warning('Redis:' . Json::encode([$name, $arguments]) . (microtime(true) - $time)); } return $data; } /** * @param $key * @param int $timeout * @return bool|int * @throws Exception */ public function lock($key, int $timeout = 5): bool|int { $script = <<