event; $event->on(Event::RELEASE_ALL, [$this, 'destroy']); $event->on(Event::EVENT_AFTER_REQUEST, [$this, 'release']); } /** * @param $name * @param $arguments * @return mixed * @throws */ public function __call($name, $arguments): mixed { if (method_exists($this, $name)) { $data = $this->{$name}(...$arguments); } else { $data = $this->proxy()->{$name}(...$arguments); } return $data; } /** * @param $key * @param int $timeout * @return bool * @throws Exception */ public function lock($key, $timeout = 5) { $script = <<