poolName = $poolName; return $new; } /** * @return RedisProxy */ public function client(): RedisProxy { return $this->redisFactory->get($this->poolName); } /** * @template TReturn * @param class-string $scriptClass * @return TReturn */ public function lua(string $scriptClass) { $poolName = $this->poolName ?? 'default'; $key = $poolName . ':' . $scriptClass; if (!isset($this->luaHandlers[$key])) { $this->luaHandlers[$key] = new $scriptClass( $this->client(), $this->config, $this->logger ); } return $this->luaHandlers[$key]; } /** * 魔术方法代理原生 Redis 命令 (默认连接池) */ public function __call(string $method, array $arguments) { return $this->client()->{$method}(...$arguments); } }