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


PHP Repository::remember方法代码示例

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


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

示例1: cache

 /**
  * Get info from a specify url and cache that using laravel cache manager.
  *
  * @param  string $url
  * @param  null|array $options
  * @return mixed
  */
 public function cache($url, array $options = null)
 {
     $lifetime = array_get($options, 'lifetime', 60);
     array_forget($options, 'lifetime');
     $self = $this;
     return $this->cache->remember($url, $lifetime, function () use($self, $url, $options) {
         return $self->get($url, $options);
     });
 }
开发者ID:lokconnect,项目名称:oembed,代码行数:16,代码来源:Oembed.php

示例2: cached

 /**
  * Returns the cached content if NOT running locally.
  *
  * @param  string $key
  * @param  mixed  $value
  * @param  int    $time
  * @return mixed
  */
 private function cached($key, $value, $time = 5)
 {
     if (App::environment('local') === false) {
         return $this->cache->remember($key, $time, function () use($value) {
             return $value;
         });
     } else {
         return $value;
     }
 }
开发者ID:nothing-fr,项目名称:legacy-codex,代码行数:18,代码来源:CacheTrait.php

示例3: getColumnsOnCache

 /**
  * To get all columns on caching
  * 
  * @param \Illuminate\Database\Eloquent\Model $model
  * @return array
  */
 protected function getColumnsOnCache(Model $model)
 {
     /**
      * In normal scenario tables and  columns often is not changed. 
      * Therefore every time it is not need to access the database for knowing 
      * columns name. We don't want make preoccupy/busy to the database. 
      */
     $fullKey = $this->getFullName($model);
     return $this->cache->remember($fullKey, $this->getRememberTime(), function () use($model) {
         return $this->builder->getColumnListing($model->getTable());
     });
 }
开发者ID:muratsplat,项目名称:multilang,代码行数:18,代码来源:CheckerAttribute.php

示例4: data

 protected function data()
 {
     if (!$this->loaded) {
         $this->data = $this->original = $this->cache->remember('fluxbb.config', 24 * 60, function () {
             $data = $this->database->table('config')->get();
             $cache = array();
             foreach ($data as $row) {
                 $cache[$row->conf_name] = $row->conf_value;
             }
             return $cache;
         });
         $this->loaded = true;
     }
     return $this->data;
 }
开发者ID:fluxbb,项目名称:core,代码行数:15,代码来源:ConfigRepository.php

示例5: remember

 /**
  * Get an item from the cache, or store the default value.
  *
  * @param  string        $key
  * @param  \DateTime|int $minutes
  * @param  \Closure      $callback
  *
  * @return mixed
  */
 public function remember($key, $minutes, Closure $callback)
 {
     if ($this->enabled) {
         return $this->cache->remember($key, $minutes, $callback);
     }
     return $callback;
 }
开发者ID:wegnermedia,项目名称:melon,代码行数:16,代码来源:Cacher.php

示例6: retrieveByReference

 /**
  * Retrieve a model object by its reference value, if it has one
  *
  * @param $reference
  * @return null
  */
 public function retrieveByReference($reference)
 {
     $referenceColumn = $this->referenceIdColumnName();
     if ($this->model->isFillable($referenceColumn)) {
         $key = $this->resourceName . '.' . $referenceColumn . '.' . $reference;
         return $this->cache->remember($key, 10, function () use($reference) {
             return $this->model->where($this->referenceIdColumnName(), $reference)->first();
         });
     } else {
         return null;
     }
 }
开发者ID:srlabs,项目名称:groundwork,代码行数:18,代码来源:BaseRepository.php

示例7: remember

 /**
  * Get an item from the cache, or store the default value.
  *
  * @param string $key
  * @param \DateTime|int $minutes
  * @param \Closure $callback
  * @return mixed 
  * @static 
  */
 public static function remember($key, $minutes, $callback)
 {
     return \Illuminate\Cache\Repository::remember($key, $minutes, $callback);
 }
开发者ID:satriashp,项目名称:tour,代码行数:13,代码来源:_ide_helper.php

示例8: remember

 /**
  * Get an item from the cache, or store the default value.
  *
  * @param  mixed  $key
  * @param  \DateTime|int  $minutes
  * @param  \Closure  $callback
  * @return mixed
  */
 public function remember($key, $minutes, Closure $callback)
 {
     if (is_array($key)) {
         return $this->rememberMany($key, $minutes, $callback);
     }
     return parent::remember($key, $minutes, $callback);
 }
开发者ID:pulkitjalan,项目名称:multicache,代码行数:15,代码来源:Repository.php

示例9: getCachedLangModels

 /**
  * To get all lang models on the cache driver
  * 
  * @return \Illuminate\Database\Eloquent\Collection
  */
 protected function getCachedLangModels()
 {
     $key = $this->getKeyOfCachedLangModel($this->getMainModel()->langModels()->getRelated());
     return $this->cache->remember($key, $this->getRememberTime(), function () {
         return $this->getAllLangModels()->getRelated()->all();
     });
 }
开发者ID:muratsplat,项目名称:multilang,代码行数:12,代码来源:Wrapper.php

示例10: fetch

 /**
  * @author Rohit Arora
  *
  * @param array $columns
  *
  * @return Collection
  */
 public function fetch($columns = [ALL_FIELDS])
 {
     return $this->Cache->remember('posts-' . implode('-', $columns), 60, function () use($columns) {
         return $this->PostContract->fetch($columns);
     });
 }
开发者ID:chetanwadhwa,项目名称:laravel,代码行数:13,代码来源:Cache.php


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