當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。