diff --git a/src/Ast/DtoProxyClass.php b/src/Ast/DtoProxyClass.php index 2403203..01d8fbd 100644 --- a/src/Ast/DtoProxyClass.php +++ b/src/Ast/DtoProxyClass.php @@ -75,8 +75,11 @@ public function generic(): void $classLoader->register(true); return; } - $this->removeProxies($proxyDir); - $this->genProxyFile(); + if (! $this->dtoConfig->isScanCacheable()) { + $this->removeProxies($proxyDir); + $this->genProxyFile(); + } + exit; } diff --git a/src/DtoConfig.php b/src/DtoConfig.php index 90afcea..5af1782 100644 --- a/src/DtoConfig.php +++ b/src/DtoConfig.php @@ -17,11 +17,14 @@ class DtoConfig private int $dto_default_value_level = 0; + private bool $scan_cacheable = false; + private ?Convert $responses_global_convert = null; private ?ScanHandlerInterface $scan_handler = null; public function __construct(ConfigInterface $config) { + $this->scan_cacheable = $config->get('scan_cacheable',false); $data = $config->get('dto', []) ?: $config->get('api_docs', []); $jsonMapper = Mapper::getJsonMapper('bIgnoreVisibility'); // 私有属性和函数 @@ -62,4 +65,9 @@ public function getScanHandler(): ScanHandlerInterface return $this->scan_handler ?? new PcntlScanHandler(); } + public function isScanCacheable(): bool + { + return $this->scan_cacheable; + } + }