本文整理汇总了PHP中Nette\Caching\Cache::derive方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::derive方法的具体用法?PHP Cache::derive怎么用?PHP Cache::derive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Caching\Cache
的用法示例。
在下文中一共展示了Cache::derive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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;
}
示例2: __construct
/**
* @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;
}
示例3: __construct
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();
});
}
示例4: __construct
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;
});
}
示例5: __construct
public function __construct(Connection $connection, Cache $cache)
{
$key = md5(json_encode($connection->getConfig()));
$this->connection = $connection;
$this->cache = $cache->derive('mapper.' . $key);
}