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


PHP CacheProvider::fetch方法代码示例

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


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

示例1: get

 /**
  * @param string $key
  * @return mixed|null
  */
 public function get($key)
 {
     if (!$this->cache->contains($key)) {
         $this->loadSettings();
     }
     return $this->cache->fetch($key);
 }
开发者ID:harentius,项目名称:blog-bundle,代码行数:11,代码来源:SettingsProvider.php

示例2: getVersion

 /**
  * @param string $packageName
  * @return string
  */
 public function getVersion($packageName = OroPlatformBundle::PACKAGE_NAME)
 {
     // Get package version from local cache if any
     if (isset($this->packageVersions[$packageName])) {
         return $this->packageVersions[$packageName];
     }
     // Try to get package version from persistent cache
     if ($this->cache && $this->cache->contains($packageName)) {
         $version = $this->cache->fetch($packageName);
     } else {
         // Get package version from composer repository
         $packages = $this->factory->getLocalRepository()->findPackages($packageName);
         if ($package = current($packages)) {
             /** @var PackageInterface $package */
             $version = $package->getPrettyVersion();
         } else {
             $version = self::UNDEFINED_VERSION;
         }
         //Save package version to persistent cache
         if ($this->cache) {
             $this->cache->save($packageName, $version);
         }
     }
     // Save package version to local cache
     $this->packageVersions[$packageName] = $version;
     return $version;
 }
开发者ID:Maksold,项目名称:platform,代码行数:31,代码来源:VersionHelper.php

示例3: getTimestamp

 /**
  * Gets the timestamp of the last update of database translations for the given locale
  *
  * @param string $locale
  * @return int|bool timestamp or false if the timestamp is not cached yet
  */
 public function getTimestamp($locale)
 {
     if (!isset($this->localCache[$locale])) {
         $this->localCache[$locale] = $this->cacheImpl->fetch($locale);
     }
     return $this->localCache[$locale];
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:DynamicTranslationMetadataCache.php

示例4: get

 /**
  * Build menu.
  *
  * @param  string        $alias
  * @param  array         $options
  * @return ItemInterface
  */
 public function get($alias, array $options = [])
 {
     $this->assertAlias($alias);
     if (!array_key_exists($alias, $this->menus)) {
         if ($this->cache && $this->cache->contains($alias)) {
             $menuData = $this->cache->fetch($alias);
             $this->menus[$alias] = $this->factory->createFromArray($menuData);
         } else {
             $menu = $this->factory->createItem($alias);
             /** @var BuilderInterface $builder */
             // try to find builder for the specified menu alias
             if (array_key_exists($alias, $this->builders)) {
                 foreach ($this->builders[$alias] as $builder) {
                     $builder->build($menu, $options, $alias);
                 }
             }
             // In any case we must run common builder
             if (array_key_exists(self::COMMON_BUILDER_ALIAS, $this->builders)) {
                 foreach ($this->builders[self::COMMON_BUILDER_ALIAS] as $builder) {
                     $builder->build($menu, $options, $alias);
                 }
             }
             $this->menus[$alias] = $menu;
             $this->eventDispatcher->dispatch(ConfigureMenuEvent::getEventName($alias), new ConfigureMenuEvent($this->factory, $menu));
             $this->sort($menu);
             if ($this->cache) {
                 $this->cache->save($alias, $menu->toArray());
             }
         }
     }
     return $this->menus[$alias];
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:39,代码来源:BuilderChainProvider.php

示例5: get

 /**
  * @return \Heyday\Redirects\Redirect[]
  */
 public function get()
 {
     $key = $this->dataSource->getKey();
     if (!($result = $this->cache->fetch($key))) {
         $this->cache->save($key, $result = $this->dataSource->get());
     }
     return $result;
 }
开发者ID:helpfulrobot,项目名称:heyday-silverstripe-redirects,代码行数:11,代码来源:CachedDataSource.php

示例6: getCachedAssetVersion

 /**
  * @param string $packageName
  *
  * @return int
  */
 protected function getCachedAssetVersion($packageName)
 {
     if (!array_key_exists($packageName, $this->localCache)) {
         $version = $this->cache->fetch($packageName);
         $this->localCache[$packageName] = false !== $version ? $version : 0;
     }
     return $this->localCache[$packageName];
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:DynamicAssetVersionManager.php

示例7: build

 /**
  * (non-PHPdoc)
  * @see Generator/Admingenerator\GeneratorBundle\Generator.GeneratorInterface::build()
  */
 public function build()
 {
     if ($this->cacheProvider->fetch($this->getCacheKey())) {
         return;
     }
     $this->doBuild();
     $this->cacheProvider->save($this->getCacheKey(), true);
 }
开发者ID:amacrobert-meq,项目名称:AdmingeneratorGeneratorBundle,代码行数:12,代码来源:Generator.php

示例8: __construct

 /**
  * @param DocumentFinder $finder For finding documents.
  * @param DocumentParser $parser For reading document annotations.
  * @param CacheProvider  $cache  Cache provider to store the meta data for later use.
  */
 public function __construct($finder, $parser, $cache = null)
 {
     $this->finder = $finder;
     $this->parser = $parser;
     $this->cache = $cache;
     if ($this->cache) {
         $this->mappings = $this->cache->fetch('ongr.metadata.mappings');
     }
 }
开发者ID:massiveart,项目名称:ElasticsearchBundle,代码行数:14,代码来源:MetadataCollector.php

示例9: getItem

 /**
  * Get an item.
  *
  * @param  string $cacheId
  * @param  bool   $success
  *
  * @return mixed Data on success, null on failure
  */
 public function getItem($cacheId, &$success = null)
 {
     if (!$this->hasItem($cacheId)) {
         $success = false;
         return null;
     }
     $cacheId = $this->normalizeKey($cacheId);
     $success = true;
     return unserialize($this->cache->fetch($cacheId));
 }
开发者ID:gunnilx,项目名称:WurflCache,代码行数:18,代码来源:DoctrineCacheConnector.php

示例10: get

 /**
  * {@inheritdoc}
  */
 public function get(RequesterInterface $requester, ResourceInterface $resource)
 {
     $cacheId = $this->getCacheId($requester, $resource);
     $permission = $this->cacheProvider->fetch($cacheId);
     if ($permission instanceof PermissionInterface) {
         return $permission;
     }
     $this->cacheProvider->delete($cacheId);
     return;
 }
开发者ID:alexdpy,项目名称:acl,代码行数:13,代码来源:PermissionBuffer.php

示例11: canReblog

 /**
  * {@inheritdoc}
  */
 public function canReblog($post)
 {
     $cacheKey = $this->makeCacheKey($post);
     $cached = $this->cache->fetch($cacheKey);
     if ($cached) {
         return false;
     }
     $this->cache->save($cacheKey, '1', $this->term);
     return true;
 }
开发者ID:ushios,项目名称:tumblr,代码行数:13,代码来源:IgnoreDuplicateReblogStrategy.php

示例12: get

 /**
  * Returns the data for the given key.
  *
  * @param  string $key     The key to search for.
  * @param  mixed  $default Default value to return if there is no data.
  *
  * @return mixed  The cached data, default value or null, if no cache entry exists for the given id.
  */
 public function get($key, $default = false)
 {
     $data = $this->cacheProvider->fetch($key);
     if ($data === false && $default !== false) {
         return $default;
     } elseif ($data === false) {
         return null;
     }
     return $data;
 }
开发者ID:picks44,项目名称:KayueEssenceBundle,代码行数:18,代码来源:Cache.php

示例13: preFind

 /**
  * @param EventInterface $event
  */
 public function preFind(EventInterface $event)
 {
     if (!preg_match('/\\d$/', $this->cacheId)) {
         return;
         //The current route is a POST, do not cache new resources with this cache ID
     }
     if ($this->cache->contains($this->cacheId)) {
         $event->stopPropagation(true);
         return $this->cache->fetch($this->cacheId);
     }
 }
开发者ID:comphppuebla,项目名称:restful-extensions,代码行数:14,代码来源:CacheListener.php

示例14: __construct

 /**
  * @param \Doctrine\Common\Cache\CacheProvider $cacheDriver
  */
 public function __construct($cacheDriver = null)
 {
     if (!is_null($cacheDriver) && class_exists('\\Doctrine\\Common\\Cache\\CacheProvider')) {
         if ($cacheDriver instanceof \Doctrine\Common\Cache\CacheProvider) {
             $this->cacheDriver = $cacheDriver;
             if ($this->cacheDriver->contains($this->cacheKey)) {
                 $this->data = $this->cacheDriver->fetch($this->cacheKey);
             }
         }
     }
 }
开发者ID:teknomavi,项目名称:tcmb,代码行数:14,代码来源:Doviz.php

示例15: saveCollectInformation

 public function saveCollectInformation($id, $information)
 {
     $this->cache->save($id, $information);
     $indexArray = $this->cache->fetch('index');
     if (empty($indexArray)) {
         $indexArray = [];
     }
     $indexArray[$id] = array_merge($information['request'], $information['response']);
     $this->cache->save('index', $indexArray);
     return $id;
 }
开发者ID:shyim,项目名称:shopware-profiler,代码行数:11,代码来源:Collector.php


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