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


PHP FrontendInterface::load方法代码示例

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


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

示例1:

 function it_checks_if_item_exists_in_cache_without_creating_cache_item()
 {
     $this->cacheFrontend->load('prefix_key1')->willReturn(serialize('test'));
     $this->cacheFrontend->load('prefix_key2')->willReturn(false);
     $this->cacheItemFactory->create(Argument::any())->shouldNotBeCalled();
     $this->hasItem('key1')->shouldReturn(true);
     $this->hasItem('key2')->shouldReturn(false);
 }
开发者ID:ecomdev,项目名称:magento-psr6-bridge,代码行数:8,代码来源:CacheItemPoolSpec.php

示例2: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if ($this->_appState->isInstalled() && !$this->_cache->load('data_upgrade')) {
         $this->_dbUpdater->updateScheme();
         $this->_dbUpdater->updateData();
         $this->_cache->save('true', 'data_upgrade');
     }
     return $proceed($request);
 }
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param \Closure $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @throws \Magento\Framework\Module\Exception
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->cache->load('db_is_up_to_date')) {
         if (!$this->isDbUpToDate()) {
             throw new \Magento\Framework\Module\Exception('Looks like database is outdated. Please, use setup tool to perform update');
         } else {
             $this->cache->save('true', 'db_is_up_to_date');
         }
     }
     return $proceed($request);
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:20,代码来源:DbStatusValidator.php

示例4: fetchAll

 /**
  * {@inheritdoc}
  */
 public function fetchAll(\Zend_Db_Select $select, array $bindParams = array())
 {
     $cacheId = $this->_getSelectCacheId($select);
     $result = $this->_cache->load($cacheId);
     if ($result) {
         $result = unserialize($result);
     } else {
         $result = $this->_fetchStrategy->fetchAll($select, $bindParams);
         $this->_cache->save(serialize($result), $cacheId, $this->_cacheTags, $this->_cacheLifetime);
     }
     return $result;
 }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例5: _initializeConfigList

 /**
  * Init cached list of validation files
  */
 protected function _initializeConfigList()
 {
     if (!$this->_configFiles) {
         $this->_configFiles = $this->cache->load(self::CACHE_KEY);
         if (!$this->_configFiles) {
             $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml');
             $this->cache->save(serialize($this->_configFiles), self::CACHE_KEY);
         } else {
             $this->_configFiles = unserialize($this->_configFiles);
         }
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:Factory.php

示例6: load

 /**
  * Load modules DI configuration
  *
  * @param string $area
  * @return array
  */
 public function load($area)
 {
     $cacheId = $area . '::DiConfig';
     $data = $this->_cache->load($cacheId);
     if (!$data) {
         $data = $this->_reader->read($area);
         $this->_cache->save(serialize($data), $cacheId);
     } else {
         $data = unserialize($data);
     }
     return $data;
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例7: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param \Closure $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @throws \Magento\Framework\Exception\LocalizedException
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->cache->load('db_is_up_to_date')) {
         $errors = $this->dbVersionInfo->getDbVersionErrors();
         if ($errors) {
             $formattedErrors = $this->formatErrors($errors);
             throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.' . ' %1The following modules are outdated:%2%3', [PHP_EOL, PHP_EOL, implode(PHP_EOL, $formattedErrors)]));
         } else {
             $this->cache->save('true', 'db_is_up_to_date');
         }
     }
     return $proceed($request);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:DbStatusValidator.php

示例8: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param \Closure $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @throws \Magento\Framework\Module\Exception
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->cache->load('db_is_up_to_date')) {
         $errors = $this->dbVersionInfo->getDbVersionErrors();
         if ($errors) {
             $formattedErrors = $this->formatErrors($errors);
             throw new \Magento\Framework\Module\Exception('Please update your database: Run "php -f index.php update" from the Magento root/setup directory.' . PHP_EOL . 'The following modules are outdated:' . PHP_EOL . implode(PHP_EOL, $formattedErrors));
         } else {
             $this->cache->save('true', 'db_is_up_to_date');
         }
     }
     return $proceed($request);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:DbStatusValidator.php

示例9: getMethodsMap

 /**
  * Return service interface or Data interface methods loaded from cache
  *
  * @param string $interfaceName
  * @return array
  * <pre>
  * Service methods' reflection data stored in cache as 'methodName' => 'returnType'
  * ex.
  * [
  *  'create' => '\Magento\Customer\Api\Data\Customer',
  *  'validatePassword' => 'boolean'
  * ]
  * </pre>
  */
 public function getMethodsMap($interfaceName)
 {
     $key = self::SERVICE_INTERFACE_METHODS_CACHE_PREFIX . "-" . md5($interfaceName);
     if (!isset($this->serviceInterfaceMethodsMap[$key])) {
         $methodMap = $this->cache->load($key);
         if ($methodMap) {
             $this->serviceInterfaceMethodsMap[$key] = unserialize($methodMap);
         } else {
             $methodMap = $this->getMethodMapViaReflection($interfaceName);
             $this->serviceInterfaceMethodsMap[$key] = $methodMap;
             $this->cache->save(serialize($this->serviceInterfaceMethodsMap[$key]), $key);
         }
     }
     return $this->serviceInterfaceMethodsMap[$key];
 }
开发者ID:opexsw,项目名称:magento2,代码行数:29,代码来源:MethodsMap.php

示例10: __construct

 /**
  * @param \Magento\Framework\Config\ReaderInterface $reader
  * @param \Magento\Framework\Config\ScopeListInterface $scopeList
  * @param \Magento\Framework\Cache\FrontendInterface $cache
  * @param \Magento\Framework\ObjectManager\Relations $relations
  * @param \Magento\Framework\Interception\ObjectManager\Config $omConfig
  * @param \Magento\Framework\ObjectManager\Definition $classDefinitions
  * @param string $cacheId
  */
 public function __construct(\Magento\Framework\Config\ReaderInterface $reader, \Magento\Framework\Config\ScopeListInterface $scopeList, \Magento\Framework\Cache\FrontendInterface $cache, \Magento\Framework\ObjectManager\Relations $relations, \Magento\Framework\Interception\ObjectManager\Config $omConfig, \Magento\Framework\ObjectManager\Definition $classDefinitions, $cacheId = 'interception')
 {
     $this->_omConfig = $omConfig;
     $this->_relations = $relations;
     $this->_classDefinitions = $classDefinitions;
     $this->_cache = $cache;
     $this->_cacheId = $cacheId;
     $this->_reader = $reader;
     $intercepted = $this->_cache->load($this->_cacheId);
     if ($intercepted !== false) {
         $this->_intercepted = unserialize($intercepted);
     } else {
         $config = array();
         foreach ($scopeList->getAllScopes() as $scope) {
             $config = array_replace_recursive($config, $this->_reader->read($scope));
         }
         unset($config['preferences']);
         foreach ($config as $typeName => $typeConfig) {
             if (!empty($typeConfig['plugins'])) {
                 $this->_intercepted[ltrim($typeName, '\\')] = true;
             }
         }
         foreach ($config as $typeName => $typeConfig) {
             $this->hasPlugins(ltrim($typeName, '\\'));
         }
         foreach ($classDefinitions->getClasses() as $class) {
             $this->hasPlugins($class);
         }
         $this->_cache->save(serialize($this->_intercepted), $this->_cacheId);
     }
 }
开发者ID:,项目名称:,代码行数:40,代码来源:

示例11: getScope

 /**
  * Retrieve config section
  *
  * @param string $scopeType
  * @param string|\Magento\Framework\DataObject|null $scopeCode
  * @return \Magento\Framework\App\Config\DataInterface
  */
 public function getScope($scopeType, $scopeCode = null)
 {
     $scopeCode = $this->_getScopeCode($scopeType, $scopeCode);
     $code = $scopeType . '|' . $scopeCode;
     if (!isset($this->_scopes[$code])) {
         // Key by url to support dynamic {{base_url}} and port assignments
         $host = $this->getRequest()->getHttpHost();
         $port = $this->getRequest()->getServer('SERVER_PORT');
         $path = $this->getRequest()->getBasePath();
         $urlInfo = $host . $port . trim($path, '/');
         $cacheKey = $this->_cacheId . '|' . $code . '|' . $urlInfo;
         $data = $this->_cache->load($cacheKey);
         if ($data) {
             $data = unserialize($data);
         } else {
             $reader = $this->_readerPool->getReader($scopeType);
             if ($scopeType === ScopeConfigInterface::SCOPE_TYPE_DEFAULT) {
                 $data = $reader->read();
             } else {
                 $data = $reader->read($scopeCode);
             }
             $this->_cache->save(serialize($data), $cacheKey, [self::CACHE_TAG]);
         }
         $this->_scopes[$code] = $this->_dataFactory->create(['data' => $data]);
     }
     return $this->_scopes[$code];
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:34,代码来源:ScopePool.php

示例12: __construct

 /**
  * @param \Magento\Framework\Config\ReaderInterface $reader
  * @param \Magento\Framework\Config\ScopeListInterface $scopeList
  * @param \Magento\Framework\Cache\FrontendInterface $cache
  * @param \Magento\Framework\ObjectManager\RelationsInterface $relations
  * @param \Magento\Framework\Interception\ObjectManager\ConfigInterface $omConfig
  * @param \Magento\Framework\ObjectManager\DefinitionInterface $classDefinitions
  * @param string $cacheId
  */
 public function __construct(\Magento\Framework\Config\ReaderInterface $reader, \Magento\Framework\Config\ScopeListInterface $scopeList, \Magento\Framework\Cache\FrontendInterface $cache, \Magento\Framework\ObjectManager\RelationsInterface $relations, \Magento\Framework\Interception\ObjectManager\ConfigInterface $omConfig, \Magento\Framework\ObjectManager\DefinitionInterface $classDefinitions, $cacheId = 'interception')
 {
     $this->_omConfig = $omConfig;
     $this->_relations = $relations;
     $this->_classDefinitions = $classDefinitions;
     $this->_cache = $cache;
     $this->_cacheId = $cacheId;
     $this->_reader = $reader;
     $this->_scopeList = $scopeList;
     $intercepted = $this->_cache->load($this->_cacheId);
     if ($intercepted !== false) {
         $this->_intercepted = unserialize($intercepted);
     } else {
         $this->initialize($this->_classDefinitions->getClasses());
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:25,代码来源:Config.php

示例13: hasItem

 /**
  * Confirms if the cache contains specified cache item.
  *
  * Note: This method MAY avoid retrieving the cached value for performance reasons.
  * This could result in a race condition with CacheItemInterface::get(). To avoid
  * such situation use CacheItemInterface::isHit() instead.
  *
  * @param string $key
  *    The key for which to check existence.
  *
  * @throws InvalidArgumentException
  *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
  *   MUST be thrown.
  *
  * @return bool
  *  True if item exists in the cache, false otherwise.
  */
 public function hasItem($key)
 {
     if ($this->cacheFrontend->load($this->prepareKey($key)) !== false) {
         return true;
     }
     return false;
 }
开发者ID:ecomdev,项目名称:magento-psr6-bridge,代码行数:24,代码来源:CacheItemPool.php

示例14: _loadTypeStatuses

 /**
  * Load statuses (enabled/disabled) of cache types
  *
  * @param bool $forceDisableAll
  * @return void
  */
 private function _loadTypeStatuses($forceDisableAll = false)
 {
     $typeOptions = $this->_cacheFrontend->load(self::CACHE_ID);
     if ($typeOptions !== false) {
         $typeOptions = unserialize($typeOptions);
     } else {
         $typeOptions = $this->_options->getAllOptions();
         if ($typeOptions !== false) {
             $this->_cacheFrontend->save(serialize($typeOptions), self::CACHE_ID);
         }
     }
     if ($typeOptions) {
         foreach ($typeOptions as $cacheType => $isTypeEnabled) {
             $this->setEnabled($cacheType, $isTypeEnabled && !$forceDisableAll);
         }
     }
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:23,代码来源:State.php

示例15: _loadCache

 /**
  * Loading data cache
  *
  * @return array|bool
  */
 protected function _loadCache()
 {
     $data = $this->_cache->load($this->getCacheId());
     if ($data) {
         $data = unserialize($data);
     }
     return $data;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Translate.php


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