Skip to content

Commit

Permalink
support scan_cacheable
Browse files Browse the repository at this point in the history
  • Loading branch information
tw2066 committed Sep 5, 2024
1 parent 44d0967 commit 8a58477
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Ast/DtoProxyClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 8 additions & 0 deletions src/DtoConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
// 私有属性和函数
Expand Down Expand Up @@ -62,4 +65,9 @@ public function getScanHandler(): ScanHandlerInterface
return $this->scan_handler ?? new PcntlScanHandler();
}

public function isScanCacheable(): bool
{
return $this->scan_cacheable;
}

}

0 comments on commit 8a58477

Please sign in to comment.