public function __construct(string $wwwDir, Ytnuk\Web\Domain\Repository $repository, VitKutny\Version\Filter $versionFilter, Tracy\ILogger $logger, Nette\Caching\IStorage $storage) { parent::__construct(); $this->wwwDir = $wwwDir; $this->repository = $repository; $this->logger = $logger; $this->cache = new Nette\Caching\Cache($storage, strtr(self::class, '\\', Nette\Caching\Cache::NAMESPACE_SEPARATOR)); $this->filterInCache = $this->cache->derive('filterIn'); $this->filterOutCache = $this->cache->derive('filterOut'); $this->versionFilter = $versionFilter; }
/** * @param ITemplateLocator * @param Cache * @param string|null * @param bool */ public function __construct(ITemplateLocator $templateLocator, ICachingStorage $storage, $setupFingerprint = NULL, $onlyExistingFiles = FALSE) { $this->templateLocator = $templateLocator; $cache = new Cache($storage, 'Rixxi.TemplateLocator'); if ($setupFingerprint !== $cache['setupFingerprint']) { $cache->clean(array(Cache::ALL => TRUE)); $cache['setupFingerprint'] = $setupFingerprint; } $this->filesCache = $cache->derive('files'); $this->layoutFilesCache = $cache->derive('layoutFiles'); $this->componentFilesCache = $cache->derive('componentFiles'); $this->onlyExistingFiles = $onlyExistingFiles; }
public function __construct(Connection $connection, $storageName, array $entityPrimaryKey, Cache $cache) { $this->platform = new CachedPlatform($connection, $cache->derive('db_reflection')); $this->storageName = $storageName; $this->entityPrimaryKey = $entityPrimaryKey; $cache = $cache->derive('storage_reflection'); $this->mappings = $cache->load('nextras.orm.storage_reflection.' . md5($this->storageName) . '.mappings', function () { return $this->getDefaultMappings(); }); $this->modifiers = $cache->load('nextras.orm.storage_reflection.' . md5($this->storageName) . '.modifiers', function () { return $this->getDefaultModifiers(); }); }
public function __construct(array $entityClassesMap, Cache $cache, IMetadataParserFactory $metadataParserFactory, IRepositoryLoader $repositoryLoader) { static::$metadata = $cache->derive('metadata')->load($entityClassesMap, function (&$dp) use($entityClassesMap, $metadataParserFactory, $repositoryLoader) { $metadata = []; $annotationParser = $metadataParserFactory->create($entityClassesMap); foreach (array_keys($entityClassesMap) as $className) { $metadata[$className] = $annotationParser->parseMetadata($className, $dp[Cache::FILES]); } $validator = new MetadataValidator(); $validator->validate($metadata, $repositoryLoader); return $metadata; }); }
public function __construct(Connection $connection, Cache $cache) { $key = md5(json_encode($connection->getConfig())); $this->connection = $connection; $this->cache = $cache->derive('mapper.' . $key); }