*/ class SourceCache implements DefinitionSource, MutableDefinitionSource { public const CACHE_KEY = 'php-di.definitions.'; public function __construct( private DefinitionSource $cachedSource, private string $cacheNamespace = '', ) { } public function getDefinition(string $name): Definition|null { $definition = apcu_fetch($this->getCacheKey($name)); if ($definition === false) { $definition = $this->cachedSource->getDefinition($name); // Update the cache if ($this->shouldBeCached($definition)) { apcu_store($this->getCacheKey($name), $definition); } } return $definition; } /** * Used only for the compilation so we can skip the cache safely. */ public function getDefinitions(): array { return $this->cachedSource->getDefinitions(); } public static function isSupported(): bool { return function_exists('apcu_fetch') && ini_get('apc.enabled') && ! ('cli' === \PHP_SAPI && ! ini_get('apc.enable_cli')); } public function getCacheKey(string $name): string { return self::CACHE_KEY . $this->cacheNamespace . $name; } public function addDefinition(Definition $definition): void { throw new \LogicException('You cannot set a definition at runtime on a container that has caching enabled. Doing so would risk caching the definition for the next execution, where it might be different. You can either put your definitions in a file, remove the cache or ->set() a raw value directly (PHP object, string, int, ...) instead of a PHP-DI definition.'); } private function shouldBeCached(?Definition $definition = null): bool { return // Cache missing definitions ($definition === null) // Object definitions are used with `make()` || ($definition instanceof ObjectDefinition) // Autowired definitions cannot be all compiled and are used with `make()` || ($definition instanceof AutowireDefinition); } }__halt_compiler();----SIGNATURE:----W3f0nM06z7Y1Ifql641wNdmpoVEXzoPfXjuk5QbVRMNGjkd1RoTcE2RqmswQG0EQpLGaqPKrw/vS+RvrQMdLjpiUTPwDLajf1m18cZi5ghdEUsMhyBClgzjwKg0SSzBykxIKgoBMbL5TfwjaFX5DryMBuKn7XApnV6Db+eX+m4RX/s9k+RfBr1Xjy/hQadPSrF/VGLAuWaRDt0mMGj31svr2cPHbj9cBqxn8mrksrNm3QQEwF0bz0EfH5d/k4mo75IarL/6Bzui/iN3WtQ1BGx8XYXjOpGE0BjsDIspVBEggBRVXm6MZTq2pHmamrJ2/jX649/ZRHY6v3i7GngJY0jEe14XYwBm/G3613tmN2oVwCZZpcbyVioZfVl+kHdVA3JiLCsHGTVorXg743Ir8vGitkPUpzxln0267eEY9bGKIf6D57YrG+YUAfXkLWDABL41zUc+vbfprZyiePZIE0AqZ5rHbK3WwHBaKur75h4cmmpsmgVvNq5wrAgzYWGcJpJIIBKsRr+DmInETzPf7xuNnK3RttOHl3vS+iWvJ6x6wB113svcgaXhroD8tEecVs/PFr8bQOxeOhSYtQ1yHxYBILQx0VRUUauaaAzeDwVd4i2ltZ8jvmkUKxKdFBNh2gC23PhdJ/mJa4iQEzkZU2iPPoJNiCmqVFDk/3uT4zX8=----ATTACHMENT:----MTEyMzcyMTk3OTc1MzQ3NiAxNDkyNTgyMjQ4OTcxNjA1IDQyOTkzODYyNjIwMDMwNjg=