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


PHP Repository::remember方法代码示例

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


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

示例1: resolve

 /**
  * @param $name
  *
  * @return Sidebar
  */
 public function resolve($name)
 {
     $duration = $this->config->get('sidebar.cache.duration');
     return $this->cache->remember(CacheKey::get($name), $duration, function () use($name) {
         return $this->resolver->resolve($name);
     });
 }
开发者ID:fordongu,项目名称:maigc-menubar,代码行数:12,代码来源:StaticCacheResolver.php

示例2: get

 /**
  * Get the collaborators for a repo.
  *
  * @param \StyleCI\StyleCI\Models\Repo $repo
  *
  * @return int[]
  */
 public function get(Repo $repo)
 {
     // cache the collaborator info from github for 12 hours
     return $this->cache->remember("{$repo->id}collaborators", 720, function () use($repo) {
         return $this->fetchFromGitHub($repo->user, $repo->name);
     });
 }
开发者ID:tangtienviet,项目名称:StyleCI,代码行数:14,代码来源:Collaborators.php

示例3: getComposerFile

 /**
  * Get the decoded contents from the main composer.json file
  * @return object
  */
 private function getComposerFile()
 {
     $composerFile = $this->cache->remember('app.version', 1440, function () {
         return $this->filesystem->get('composer.json');
     });
     return json_decode($composerFile);
 }
开发者ID:Houbsi,项目名称:Core,代码行数:11,代码来源:ApplicationVersionViewComposer.php

示例4: __call

 /**
  *
  */
 public function __call($method, $params)
 {
     if (!method_exists($this->repository, $method)) {
         throw new RepositoryException("Method {$method} not found on repository");
     }
     if ($this->skipCache === true || config('laravel-database.cache') === false) {
         return call_user_func_array(array($this->repository, $method), $params);
     } else {
         if (empty($this->key)) {
             $this->cacheKey($this->generateKey($method, $params));
         }
         $key = $this->key;
         unset($this->key);
         if ($this->refreshCache) {
             $this->cache->forget($key);
             $this->refreshCache = false;
         }
         if (empty($this->lifetime)) {
             $this->cacheLifetime($this->repository->getModel()->cacheLifetime());
         }
         $lifetime = $this->lifetime;
         unset($this->lifetime);
         return $this->cache->remember($key, $lifetime, function () use($method, $params) {
             return call_user_func_array(array($this->repository, $method), $params);
         });
     }
 }
开发者ID:ablunier,项目名称:laravel-database,代码行数:30,代码来源:Cache.php

示例5: get

 /**
  * Get an item from the storage.
  *
  * @param string $key
  *
  * @return string|null
  */
 public function get($key)
 {
     $data = $this->cache->remember("store.{$key}", 30, function () use($key) {
         return $this->store->get($key);
     });
     if ($data) {
         return $data;
     }
 }
开发者ID:AltThree,项目名称:Storage,代码行数:16,代码来源:CachingStore.php

示例6: performQuery

 /**
  * Query the Google Analytics Service with given parameters.
  *
  * @param string    $viewId
  * @param \DateTime $startDate
  * @param \DateTime $endDate
  * @param string    $metrics
  * @param array     $others
  *
  * @return array|null
  */
 public function performQuery(string $viewId, DateTime $startDate, DateTime $endDate, string $metrics, array $others = [])
 {
     $cacheName = $this->determineCacheName(func_get_args());
     if ($this->cacheLifeTimeInMinutes == 0) {
         $this->cache->forget($cacheName);
     }
     return $this->cache->remember($cacheName, $this->cacheLifeTimeInMinutes, function () use($viewId, $startDate, $endDate, $metrics, $others) {
         return $this->service->data_ga->get("ga:{$viewId}", $startDate->format('Y-m-d'), $endDate->format('Y-m-d'), $metrics, $others);
     });
 }
开发者ID:spatie,项目名称:laravel-analytics,代码行数:21,代码来源:AnalyticsClient.php

示例7: get

 /**
  * Get the given documentation page.
  *
  * @param  string  $version
  * @param  string  $page
  * @return string
  */
 public function get($version, $page)
 {
     return $this->cache->remember('docs.' . $version . '.' . $page, 5, function () use($version, $page) {
         $path = base_path('resources/docs/' . $page . '.md');
         if ($this->files->exists($path)) {
             return $this->replaceLinks($version, markdown($this->files->get($path)));
         }
         return null;
     });
 }
开发者ID:ifromz,项目名称:deploy-cloud,代码行数:17,代码来源:Documentation.php

示例8: latest

 /**
  * Returns the latest release.
  *
  * @return string
  */
 public function latest()
 {
     $release = $this->cache->remember('release.latest', 720, function () {
         $headers = ['Accept' => 'application/vnd.github.v3+json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/' . constant('CACHET_VERSION') : 'cachet'];
         if ($this->token) {
             $headers['OAUTH-TOKEN'] = $this->token;
         }
         return json_decode((new Client())->get($this->url, ['headers' => $headers])->getBody(), true);
     });
     return ['tag_name' => $release['tag_name'], 'prelease' => $release['prerelease'], 'draft' => $release['draft']];
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:16,代码来源:Releases.php

示例9: latest

 /**
  * Returns the latest credits.
  *
  * @return array|null
  */
 public function latest()
 {
     $result = $this->cache->remember('credits', 2880, function () {
         try {
             return json_decode((new Client())->get($this->url, ['headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/' . constant('CACHET_VERSION') : 'cachet']])->getBody(), true);
         } catch (Exception $e) {
             return self::FAILED;
         }
     });
     return $result === self::FAILED ? null : $result;
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:16,代码来源:Credits.php

示例10: getPaginated

 /**
  * Get a cached paginated list of all users
  * 	
  *	@param int $howMany
  * 	
  *	@param string $byFirstname
  *
  *	@return mixed
  */
 public function getPaginated($howMany = 10, $byFirstname = null)
 {
     $this->howMany = $howMany;
     $this->byFirstname = $byFirstname;
     if (!$this->byFirstname) {
         return $this->cache->remember('users.all', 20, function () {
         });
     } else {
         return $this->repository->getPaginated($this->howMany, $this->byFirstname);
     }
 }
开发者ID:talha08,项目名称:Larasocial,代码行数:20,代码来源:CachingUserRepository.php

示例11: get

 /**
  * Get the form.
  *
  * @return FormPresenter
  */
 public function get()
 {
     $this->fire('ready', ['criteria' => $this]);
     array_set($this->parameters, 'key', md5(json_encode($this->parameters)));
     array_set($this->parameters, 'options.url', array_get($this->parameters, 'options.url', $this->builder->getOption('url', 'form/handle/' . array_get($this->parameters, 'key'))));
     $this->cache->remember('form::' . array_get($this->parameters, 'key'), 30, function () {
         return $this->parameters;
     });
     $this->hydrator->hydrate($this->builder, $this->parameters);
     return (new Decorator())->decorate($this->builder->make()->getForm());
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:16,代码来源:FormCriteria.php

示例12: latest

 /**
  * Returns the latest entries.
  *
  * @return array|null
  */
 public function latest()
 {
     $result = $this->cache->remember('feeds', 720, function () {
         try {
             $xml = simplexml_load_string((new Client())->get($this->url, ['headers' => ['Accept' => 'application/rss+xml', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/' . constant('CACHET_VERSION') : 'cachet']])->getBody()->getContents(), null, LIBXML_NOCDATA);
             return json_decode(json_encode($xml));
         } catch (Exception $e) {
             return self::FAILED;
         }
     });
     return $result === self::FAILED ? null : $result;
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:17,代码来源:Feed.php

示例13: get

 /**
  * Get the given documentation page.
  *
  * @param  string $version
  * @param  string $page
  *
  * @return string
  */
 public function get($version, $page)
 {
     return $this->cache->remember('docs.' . $version . '.' . $page, $this->cacheTime, function () use($version, $page) {
         $path = $this->fullPagePath($version, $page);
         if ($this->files->exists($path)) {
             $content = $this->replaceLinks($version, markdown($this->files->get($path)));
             $title = $content ? $this->getDocTitleByContent($content) : null;
             return compact('content', 'title');
         }
         return null;
     });
 }
开发者ID:vs0uz4,项目名称:laravel-docs.artesaos.org,代码行数:20,代码来源:Documentation.php

示例14: get

 /**
  * Get a user's repos.
  *
  * @param \StyleCI\StyleCI\Models\User $user
  * @param bool                         $admin
  *
  * @return array
  */
 public function get(User $user, $admin = false)
 {
     // cache the repo info from github for 12 hours
     $list = $this->cache->remember($user->id . 'repos', 720, function () use($user) {
         return $this->fetchFromGitHub($user);
     });
     foreach (Repo::whereIn('id', array_keys($list))->get() as $repo) {
         $list[$repo->id]['enabled'] = true;
         $this->syncWithDatabase($repo, $list[$repo->id]);
     }
     return $list;
 }
开发者ID:mikaelmattsson,项目名称:StyleCI,代码行数:20,代码来源:Repos.php

示例15: latest

 /**
  * Returns the latest GitHub release.
  *
  * @return string
  */
 public function latest()
 {
     $release = $this->cache->remember('version', 720, function () {
         $headers = ['Accept' => 'application/vnd.github.v3+json'];
         // We can re-use the Emoji token here, if we have it.
         if ($token = $this->config->get('services.github.token')) {
             $headers['OAUTH-TOKEN'] = $token;
         }
         return json_decode((new Client())->get('https://api.github.com/repos/cachethq/cachet/releases/latest', ['headers' => $headers])->getBody(), true);
     });
     return $release['tag_name'];
 }
开发者ID:mohitsethi,项目名称:Cachet,代码行数:17,代码来源:Release.php


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