本文整理汇总了PHP中TYPO3\Flow\Cache\Frontend\VariableFrontend::set方法的典型用法代码示例。如果您正苦于以下问题:PHP VariableFrontend::set方法的具体用法?PHP VariableFrontend::set怎么用?PHP VariableFrontend::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Cache\Frontend\VariableFrontend
的用法示例。
在下文中一共展示了VariableFrontend::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeMatchResults
/**
* Stores the $matchResults in the cache
*
* @param Request $httpRequest
* @param array $matchResults
* @return void
*/
public function storeMatchResults(Request $httpRequest, array $matchResults)
{
if ($this->containsObject($matchResults)) {
return;
}
$this->routeCache->set($this->buildRouteCacheIdentifier($httpRequest), $matchResults, $this->extractUuids($matchResults));
}
示例2: getViewConfiguration
/**
* This method walks through the view configuration and applies
* matching configurations in the order of their specifity score.
* Possible options are currently the viewObjectName to specify
* a different class that will be used to create the view and
* an array of options that will be set on the view object.
*
* @param \TYPO3\Flow\Mvc\ActionRequest $request
* @return array
*/
public function getViewConfiguration(ActionRequest $request)
{
$cacheIdentifier = $this->createCacheIdentifier($request);
$viewConfiguration = $this->cache->get($cacheIdentifier);
if ($viewConfiguration === false) {
$configurations = $this->configurationManager->getConfiguration('Views');
$requestMatcher = new RequestMatcher($request);
$context = new Context($requestMatcher);
$matchingConfigurations = array();
foreach ($configurations as $order => $configuration) {
$requestMatcher->resetWeight();
if (!isset($configuration['requestFilter'])) {
$matchingConfigurations[$order]['configuration'] = $configuration;
$matchingConfigurations[$order]['weight'] = $order;
} else {
$result = $this->eelEvaluator->evaluate($configuration['requestFilter'], $context);
if ($result === false) {
continue;
}
$matchingConfigurations[$order]['configuration'] = $configuration;
$matchingConfigurations[$order]['weight'] = $requestMatcher->getWeight() + $order;
}
}
usort($matchingConfigurations, function ($configuration1, $configuration2) {
return $configuration1['weight'] > $configuration2['weight'];
});
$viewConfiguration = array();
foreach ($matchingConfigurations as $key => $matchingConfiguration) {
$viewConfiguration = Arrays::arrayMergeRecursiveOverrule($viewConfiguration, $matchingConfiguration['configuration']);
}
$this->cache->set($cacheIdentifier, $viewConfiguration);
}
return $viewConfiguration;
}
示例3: initializeObject
/**
* Lifecycle method, called after all dependencies have been injected.
* Here, the typeConverter array gets initialized.
*
* @return void
* @throws Exception\DuplicateTypeConverterException
*/
public function initializeObject()
{
if ($this->cache->has('typeConverterMap')) {
$this->typeConverters = $this->cache->get('typeConverterMap');
return;
}
$this->typeConverters = $this->prepareTypeConverterMap();
$this->cache->set('typeConverterMap', $this->typeConverters);
}
示例4: initializeObject
/**
* Initializes the locale service
*
* @return void
*/
public function initializeObject()
{
$this->configuration = new Configuration($this->settings['defaultLocale']);
$this->configuration->setFallbackRule($this->settings['fallbackRule']);
if ($this->cache->has('availableLocales')) {
$this->localeCollection = $this->cache->get('availableLocales');
} else {
$this->generateAvailableLocalesCollectionByScanningFilesystem();
$this->cache->set('availableLocales', $this->localeCollection);
}
}
示例5: cacheGetMergedTypoScriptObjectTree
/**
* @Flow\Around("setting(TYPO3.Neos.typoScript.enableObjectTreeCache) && method(TYPO3\Neos\Domain\Service\TypoScriptService->getMergedTypoScriptObjectTree())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return mixed
*/
public function cacheGetMergedTypoScriptObjectTree(JoinPointInterface $joinPoint)
{
$currentSiteNode = $joinPoint->getMethodArgument('startNode');
$cacheIdentifier = str_replace('.', '_', $currentSiteNode->getContext()->getCurrentSite()->getSiteResourcesPackageKey());
if ($this->typoScriptCache->has($cacheIdentifier)) {
$typoScriptObjectTree = $this->typoScriptCache->get($cacheIdentifier);
} else {
$typoScriptObjectTree = $joinPoint->getAdviceChain()->proceed($joinPoint);
$this->typoScriptCache->set($cacheIdentifier, $typoScriptObjectTree);
}
return $typoScriptObjectTree;
}
示例6: fetchCoordinatesByPostalCode
/**
* @param string $postalCode The zip code
* @param string $countryCode The two character ISO 3166-1 country code
* @return array|NULL The coordinates or NULL if none could be fetched
*/
public function fetchCoordinatesByPostalCode($postalCode, $countryCode)
{
$cacheIdentifier = $postalCode . '-' . $countryCode;
if (!isset($this->postalCodeCoordinates[$cacheIdentifier])) {
try {
$this->postalCodeCoordinates[$cacheIdentifier] = $this->geoCodingAdapter->fetchCoordinatesByPostalCode($postalCode, $countryCode);
$this->cache->set('postalCodeCoordinates', $this->postalCodeCoordinates);
} catch (NoSuchCoordinatesException $exception) {
return null;
}
}
return $this->postalCodeCoordinates[$cacheIdentifier];
}
示例7: savePolicyCache
/**
* Save the found matches to the cache.
*
* @return void
*/
public function savePolicyCache()
{
$tags = array('TYPO3_Flow_Aop');
if (!$this->methodPermissionCache->has('methodPermission')) {
$this->methodPermissionCache->set('methodPermission', $this->methodPermissions, $tags);
}
}
示例8: getResponseFromCache
/**
* @Flow\Around("setting(Ttree.Embedly.logApiRequest) && within(Ttree\Embedly\Embedly) && method(public .*->(oembed|preview|objectify|extract|services)())")
* @param JoinPointInterface $joinPoint The current join point
* @return mixed
*/
public function getResponseFromCache(JoinPointInterface $joinPoint)
{
$proxy = $joinPoint->getProxy();
$key = ObjectAccess::getProperty($proxy, 'key');
$params = $joinPoint->getMethodArgument('params');
$cacheKey = md5($joinPoint->getClassName() . $joinPoint->getMethodName() . $key . json_encode($params));
if ($this->responseCache->has($cacheKey)) {
$this->systemLogger->log(sprintf(' cache hit Embedly::%s', $joinPoint->getMethodName()), LOG_DEBUG);
return $this->responseCache->get($cacheKey);
} else {
$this->systemLogger->log(sprintf(' cache miss Embedly::%s', $joinPoint->getMethodName()), LOG_DEBUG);
}
$response = $joinPoint->getAdviceChain()->proceed($joinPoint);
$this->responseCache->set($cacheKey, $response);
return $response;
}
示例9: getLanguageLocalizedName
/**
* @param Locale $locale
* @param Language $language
* @return string
*/
public function getLanguageLocalizedName(Locale $locale, Language $language)
{
$cacheIdentifier = 'language-labels-' . $locale->getLanguage();
$labelsFromCache = $this->languageCache->get($cacheIdentifier);
if ($labelsFromCache) {
return $labelsFromCache[$language->getKey()];
}
try {
$raw = $this->cldrRepository->getModelForLocale($locale)->getRawArray('localeDisplayNames/languages');
} catch (\Exception $e) {
return 'Problem reading data for ' . $language->getKey();
}
$languages = $this->getLanguages();
$labels = array();
/** @var Language $currentLanguage */
foreach ($languages as $currentLanguage) {
try {
$key = 'language[@type="' . $currentLanguage->getKey() . '"]';
if (is_array($raw)) {
if (array_key_exists($key, $raw)) {
$labels[$currentLanguage->getKey()] = $raw[$key];
} else {
$labels[$currentLanguage->getKey()] = $currentLanguage->getName();
}
} else {
$labels[$currentLanguage->getKey()] = 'Nothing found for ' . $currentLanguage->getKey();
}
} catch (\Exception $e) {
// not found
// $labels[$key] = 'Nothing found for ' . $language->getKey();
}
}
$this->languageCache->set($cacheIdentifier, $labels);
return $labels[$language->getKey()];
}
示例10: getCachedJson
/**
* Return the json array for a given locale, sourceCatalog, xliffPath and package.
* The json will be cached.
*
* @param Locale $locale The locale
* @throws \TYPO3\Flow\I18n\Exception
* @return \TYPO3\Flow\Error\Result
*/
public function getCachedJson(Locale $locale)
{
$cacheIdentifier = md5($locale);
if ($this->xliffToJsonTranslationsCache->has($cacheIdentifier)) {
$json = $this->xliffToJsonTranslationsCache->get($cacheIdentifier);
} else {
$labels = [];
$localeChain = $this->localizationService->getLocaleChain($locale);
foreach ($this->packagesRegisteredForAutoInclusion as $packageKey => $sourcesToBeIncluded) {
if (!is_array($sourcesToBeIncluded)) {
continue;
}
$translationBasePath = Files::concatenatePaths([$this->packageManager->getPackage($packageKey)->getResourcesPath(), $this->xliffBasePath]);
// We merge labels in the chain from the worst choice to best choice
foreach (array_reverse($localeChain) as $allowedLocale) {
$localeSourcePath = Files::getNormalizedPath(Files::concatenatePaths([$translationBasePath, $allowedLocale]));
foreach ($sourcesToBeIncluded as $sourceName) {
foreach (glob($localeSourcePath . $sourceName . '.xlf') as $xliffPathAndFilename) {
$xliffPathInfo = pathinfo($xliffPathAndFilename);
$sourceName = str_replace($localeSourcePath, '', $xliffPathInfo['dirname'] . '/' . $xliffPathInfo['filename']);
$labels = Arrays::arrayMergeRecursiveOverrule($labels, $this->parseXliffToArray($xliffPathAndFilename, $packageKey, $sourceName));
}
}
}
}
$json = json_encode($labels);
$this->xliffToJsonTranslationsCache->set($cacheIdentifier, $json);
}
return $json;
}
示例11: storeMatchResults
/**
* Stores the $matchResults in the cache
*
* @param Request $httpRequest
* @param array $matchResults
* @return void
*/
public function storeMatchResults(Request $httpRequest, array $matchResults)
{
if ($this->containsObject($matchResults)) {
return;
}
$tags = $this->generateRouteTags($httpRequest->getRelativePath(), $matchResults);
$this->routeCache->set($this->buildRouteCacheIdentifier($httpRequest), $matchResults, $tags);
}
示例12: getCacheVersion
/**
* @return integer The current cache version identifier
*/
public function getCacheVersion()
{
$version = $this->xliffToJsonTranslationsCache->get('ConfigurationVersion');
if ($version === false) {
$version = time();
$this->xliffToJsonTranslationsCache->set('ConfigurationVersion', (string) $version);
}
return $version;
}
示例13: writeSessionMetaDataCacheEntry
/**
* Writes the cache entry containing information about the session, such as the
* last activity time and the storage identifier.
*
* This function does not write the whole session _data_ into the storage cache,
* but only the "head" cache entry containing meta information.
*
* The session cache entry is also tagged with "session", the session identifier
* and any custom tags of this session, prefixed with TAG_PREFIX.
*
* @return void
*/
protected function writeSessionMetaDataCacheEntry()
{
$sessionInfo = array('lastActivityTimestamp' => $this->lastActivityTimestamp, 'storageIdentifier' => $this->storageIdentifier, 'tags' => $this->tags);
$tagsForCacheEntry = array_map(function ($tag) {
return Session::TAG_PREFIX . $tag;
}, $this->tags);
$tagsForCacheEntry[] = $this->sessionIdentifier;
$this->metaDataCache->set($this->sessionIdentifier, $sessionInfo, $tagsForCacheEntry, 0);
}
示例14: initializeObject
/**
* When it's called, XML file is parsed (using parser set in $xmlParser)
* or cache is loaded, if available.
*
* @return void
*/
public function initializeObject()
{
if ($this->cache->has(md5($this->sourcePath))) {
$this->xmlParsedData = $this->cache->get(md5($this->sourcePath));
} else {
$this->xmlParsedData = $this->xmlParser->getParsedData($this->sourcePath);
$this->cache->set(md5($this->sourcePath), $this->xmlParsedData);
}
}
示例15: initializeObject
/**
* When it's called, CLDR file is parsed or cache is loaded, if available.
*
* @return void
*/
public function initializeObject()
{
if ($this->cache->has($this->cacheKey)) {
$this->parsedData = $this->cache->get($this->cacheKey);
} else {
$this->parsedData = $this->parseFiles($this->sourcePaths);
$this->parsedData = $this->resolveAliases($this->parsedData, '');
$this->cache->set($this->cacheKey, $this->parsedData);
}
}