當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache\Repository類代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Cache\Repository的典型用法代碼示例。如果您正苦於以下問題:PHP Repository類的具體用法?PHP Repository怎麽用?PHP Repository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Repository類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: cache

 /**
  * Return the cache instance with tags attached.
  *
  * @return \Illuminate\Contracts\Cache\Repository|\Illuminate\Contracts\Cache\Store
  */
 protected function cache()
 {
     if (!method_exists($this->cache, 'tags')) {
         return $this->cache;
     }
     return $this->cache->tags($this->tag);
 }
開發者ID:framgia,項目名稱:laravel-jwt,代碼行數:12,代碼來源:CacheStorage.php

示例2: isSatisfiedBy

 /**
  * @param Repository $repository
  *
  * @throws CacheTagsNotSupported
  * @return bool
  */
 public function isSatisfiedBy(Repository $repository)
 {
     if (!method_exists($repository->getStore(), 'tags')) {
         throw new CacheTagsNotSupported('Cache tags are necessary to use this kind of caching. Consider using a different caching method');
     }
     return true;
 }
開發者ID:fordongu,項目名稱:maigc-menubar,代碼行數:13,代碼來源:SupportsCacheTags.php

示例3: __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

示例4: update

 public function update($id, array $attribute)
 {
     if ($this->model->update($id, $attribute)) {
         $this->cache->forget($this->getKey('all'));
         $this->cache->forget($this->getKey('id-' . $id));
     }
 }
開發者ID:ShuvarthiDhar,項目名稱:tobacco,代碼行數:7,代碼來源:BaseCache.php

示例5: getCache

 /**
  * Returns the current cache instance
  *
  * @param  array $tags
  *
  * @return Cache
  */
 protected function getCache(array $tags)
 {
     if ($this->cache instanceof TaggableStore) {
         return $this->cache->tags(array_merge(['russian'], $tags));
     }
     return $this->cache;
 }
開發者ID:rodrigopedra,項目名稱:russian-doll-caching,代碼行數:14,代碼來源:RussianDollCaching.php

示例6: 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

示例7: 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

示例8: authenticate

 /**
  * @return string Access token
  */
 public function authenticate()
 {
     if (!$this->repository->has('brightcove.bearer')) {
         $this->repository->put('brightcove.bearer', $this->brightcove->authenticate(), $this->duration);
     }
     return $this->repository->get('brightcove.bearer');
 }
開發者ID:ronaldcastillo,項目名稱:brightcove,代碼行數:10,代碼來源:BrightCoveCacheDecorator.php

示例9: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Cache $cache)
 {
     $ips = $this->fetchExitNodeIPs()->map(function ($ip) use($cache) {
         $cache->tags(config('torinfo.caching.tags'))->put($ip, true, config('torinfo.caching.expiry'));
         return $ip;
     });
 }
開發者ID:kylestev,項目名稱:tor-info,代碼行數:12,代碼來源:CacheTorIPs.php

示例10: stats

 public function stats(Cache $cache)
 {
     if (!$cache->has('tickets.total') && !$cache->has('tickets.open')) {
         return $this->responseNoteFound('No stats found');
     }
     return $this->respond(['tickets' => ['open' => $cache->get('tickets.open'), 'total' => $cache->get('tickets.total')]]);
 }
開發者ID:anouarabdsslm,項目名稱:micro-service,代碼行數:7,代碼來源:TicketController.php

示例11: gettingStarted

 /**
  * Show the getting started screen to the user.
  *
  * @param MarkdownParser $markdown
  * @param Cache          $cache
  * @param Filesystem     $file
  *
  * @return Response
  */
 public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file)
 {
     $gettingStarted = $cache->remember('getting-started', 5, function () use($markdown, $file) {
         $gettingStarted = $file->get(base_path('resources/getting-started/readme.md'));
         return $markdown->parse($gettingStarted);
     });
     return view('getting-started')->with(compact('gettingStarted'));
 }
開發者ID:4mb,項目名稱:pi.strebl.ch,代碼行數:17,代碼來源:WelcomeController.php

示例12: roles

 /**
  * @param bool $forget
  *
  * @return \Illuminate\Database\Eloquent\Collection|Role[]|null
  */
 public function roles(bool $forget = false)
 {
     if ($forget === true) {
         return $this->cache->forget(self::ROLE_KEY);
     }
     return $this->cache->rememberForever(self::ROLE_KEY, function () {
         return app(Role::class)->with('permissions')->get();
     });
 }
開發者ID:znck,項目名稱:trust,代碼行數:14,代碼來源:Trust.php

示例13: get

 /**
  * Execute the query as a "select" statement.
  *
  * @param  array $columns
  * @return array|static[]
  */
 public function get($columns = ['*'])
 {
     $cacheKey = $this->generateCacheKey();
     if (null === ($results = $this->cache->tags($this->cacheTag)->get($cacheKey))) {
         $results = parent::get($columns);
         $this->cache->tags($this->cacheTag)->forever($cacheKey, $results);
     }
     return $results;
 }
開發者ID:bedemiralp,項目名稱:InfinityCache,代碼行數:15,代碼來源:Builder.php

示例14: getNews

 public function getNews()
 {
     $key = 'boomcms.news';
     return $this->cache->get($key, function () use($key) {
         $response = json_decode(@file_get_contents($this->newsUrl));
         $news = $response->news ?? [];
         $this->cache->put($key, $news, 3600);
         return $news;
     });
 }
開發者ID:boomcms,項目名稱:boom-core,代碼行數:10,代碼來源:BoomCMS.php

示例15: check

 public function check($value)
 {
     $result = false;
     if ($this->store->has('captcha')) {
         $captchaStore = $this->store->get('captcha');
         $result = $captchaStore->check($value);
         $this->store->forever('captcha', $captchaStore);
     }
     return $result;
 }
開發者ID:disik69,項目名稱:backend.english-roulette-v0.3,代碼行數:10,代碼來源:Captcha.php


注:本文中的Illuminate\Contracts\Cache\Repository類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。