当前位置: 首页>>代码示例>>PHP>>正文


PHP VariableFrontend::get方法代码示例

本文整理汇总了PHP中TYPO3\Flow\Cache\Frontend\VariableFrontend::get方法的典型用法代码示例。如果您正苦于以下问题:PHP VariableFrontend::get方法的具体用法?PHP VariableFrontend::get怎么用?PHP VariableFrontend::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\Flow\Cache\Frontend\VariableFrontend的用法示例。


在下文中一共展示了VariableFrontend::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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()];
 }
开发者ID:kaystrobach,项目名称:Flow.Cldr,代码行数:40,代码来源:CldrDataUtility.php

示例2: 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;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:38,代码来源:XliffService.php

示例3: 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;
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:44,代码来源:ViewConfigurationManager.php

示例4: getCachedMatchResults

 /**
  * Checks the cache for the route path given in the Request and returns the result
  *
  * @param Request $httpRequest
  * @return array|boolean the cached route values or FALSE if no cache entry was found
  */
 public function getCachedMatchResults(Request $httpRequest)
 {
     $cachedResult = $this->routeCache->get($this->buildRouteCacheIdentifier($httpRequest));
     if ($cachedResult !== FALSE) {
         $this->systemLogger->log(sprintf('Router route(): A cached Route with the cache identifier "%s" matched the path "%s".', $this->buildRouteCacheIdentifier($httpRequest), $httpRequest->getRelativePath()), LOG_DEBUG);
     }
     return $cachedResult;
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:14,代码来源:RouterCachingService.php

示例5: initializeObject

 /**
  * Initialize the object and load caches
  */
 public function initializeObject()
 {
     if (!$this->cache->get('systemNodeIdentifiers')) {
         $this->initializeSystemNodes();
     } else {
         $this->systemNodeIdentifiers = $this->cache->get('systemNodeIdentifiers');
     }
 }
开发者ID:nezaniel,项目名称:systemnodes,代码行数:11,代码来源:SystemNodeService.php

示例6: 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);
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:16,代码来源:PropertyMapper.php

示例7: getItem

 /**
  * @param string $cacheKey
  *
  * @return mixed
  */
 protected function getItem($cacheKey)
 {
     if (array_key_exists($cacheKey, $this->objectCache)) {
         return $this->objectCache[$cacheKey];
     }
     $item = $this->apiCache->get($cacheKey);
     $this->objectCache[$cacheKey] = $item;
     return $item;
 }
开发者ID:neos,项目名称:Neos.NeosIo,代码行数:14,代码来源:AbstractApiConnector.php

示例8: 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);
     }
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:16,代码来源:Service.php

示例9: 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;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:17,代码来源:TypoScriptCachingAspect.php

示例10: getSession

 /**
  * Returns the specified session. If no session with the given identifier exists,
  * NULL is returned.
  *
  * @param string $sessionIdentifier The session identifier
  * @return \TYPO3\Flow\Session\Session
  * @api
  */
 public function getSession($sessionIdentifier)
 {
     if ($this->currentSession !== NULL && $this->currentSession->isStarted() && $this->currentSession->getId() === $sessionIdentifier) {
         return $this->currentSession;
     }
     if (isset($this->remoteSessions[$sessionIdentifier])) {
         return $this->remoteSessions[$sessionIdentifier];
     }
     if ($this->metaDataCache->has($sessionIdentifier)) {
         $sessionInfo = $this->metaDataCache->get($sessionIdentifier);
         $this->remoteSessions[$sessionIdentifier] = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
         return $this->remoteSessions[$sessionIdentifier];
     }
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:22,代码来源:SessionManager.php

示例11: 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;
 }
开发者ID:ttreeagency,项目名称:Embedly,代码行数:21,代码来源:ResponseCacheAspect.php

示例12: getData

 /**
  * Returns the data associated with the given key.
  *
  * @param string $key An identifier for the content stored in the session.
  * @return mixed The contents associated with the given key
  * @throws \TYPO3\Flow\Session\Exception\SessionNotStartedException
  */
 public function getData($key)
 {
     if ($this->started !== true) {
         throw new \TYPO3\Flow\Session\Exception\SessionNotStartedException('Tried to get session data, but the session has not been started yet.', 1351162255);
     }
     return $this->storageCache->get($this->storageIdentifier . md5($key));
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:14,代码来源:Session.php

示例13: initializeObject

 /**
  * Constructs the reader, loading parsed data from cache if available.
  *
  * @return void
  */
 public function initializeObject()
 {
     if ($this->cache->has('parsedFormats') && $this->cache->has('parsedFormatsIndices') && $this->cache->has('localizedLiterals')) {
         $this->parsedFormats = $this->cache->get('parsedFormats');
         $this->parsedFormatsIndices = $this->cache->get('parsedFormatsIndices');
         $this->localizedLiterals = $this->cache->get('localizedLiterals');
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:13,代码来源:DatesReader.php

示例14: 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;
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:12,代码来源:XliffService.php

示例15: 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);
     }
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:15,代码来源:XliffModel.php


注:本文中的TYPO3\Flow\Cache\Frontend\VariableFrontend::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。