当前位置: 首页>>代码示例>>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;未经允许,请勿转载。