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