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


PHP Repository::get方法代码示例

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


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

示例1: tryFetchResultFromCache

 /**
  * @param Builder $qb
  * @param array $attributes
  * @return LengthAwarePaginator|Collection|null
  */
 public function tryFetchResultFromCache(Builder $qb, array $attributes = [])
 {
     $this->generateQueryHashFromQueryBuilder($qb, $attributes);
     if ($this->cache->has($this->actualQueryHash)) {
         return $this->cache->get($this->actualQueryHash);
     }
     return null;
 }
开发者ID:Algatux,项目名称:laravel-repository,代码行数:13,代码来源:CacheManager.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $types = $this->config->get('assets.types');
     $oldVersion = $this->cache->get('laravel-asset-versioning.version');
     $version = Carbon::now()->timestamp;
     $this->updateConfigVersion($version);
     $this->unlinkOldDirectories($types, $oldVersion);
     $this->createDistDirectories($types, $version);
 }
开发者ID:escapework,项目名称:laravel-asset-versioning,代码行数:14,代码来源:AssetDistCommand.php

示例3: testShouldReturnNullFlushRecord

 public function testShouldReturnNullFlushRecord()
 {
     $this->repository->add('memcached-testing', 'couchbase', 60);
     $this->repository->decrement('memcached-testing-decrement', 100);
     $this->repository->increment('memcached-testing-increment', 100);
     $this->repository->flush();
     $this->assertNull($this->repository->get('memcached-testing'));
     $this->assertNull($this->repository->get('memcached-testing-decrement'));
     $this->assertNull($this->repository->get('memcached-testing-increment'));
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:10,代码来源:MemcachedBucketTest.php

示例4: fetch

 /**
  * {@inheritdoc}
  */
 public function fetch($key)
 {
     try {
         $cache = unserialize($this->cache->get($key));
         if ($cache instanceof CacheEntry) {
             return $cache;
         }
     } catch (\Exception $ignored) {
         return;
     }
     return;
 }
开发者ID:kevinrob,项目名称:guzzle-cache-middleware,代码行数:15,代码来源:LaravelCacheStorage.php

示例5: loginWithToken

 /**
  * Verify the existence of the given user token.
  *
  * @param string $token
  *
  * @return \Fahita\Contracts\UserInterface|null
  */
 public function loginWithToken($token)
 {
     if ($this->verifyToken($token)) {
         $id = $this->cache->get($this->getCacheKey($token));
         $attributes = $this->redis->hgetall('users:' . $id);
         $user = (new User())->newInstance($attributes, true);
         // creating a new instance does not include the record id
         // but we want it, so we force fill it to fulfill it.
         $user->forceFill($attributes);
         return $this->login($user);
     }
 }
开发者ID:vinelab,项目名称:agency,代码行数:19,代码来源:Auth.php

示例6: get

 /**
  * Retrieve an item from the cache by key.
  *
  * @param  mixed  $key
  * @param  mixed  $default
  * @return mixed
  */
 public function get($key, $default = null)
 {
     if (is_array($key)) {
         return $this->getMany($key, $default);
     }
     return parent::get($key, $default);
 }
开发者ID:pulkitjalan,项目名称:multicache,代码行数:14,代码来源:Repository.php

示例7: postAuthorized

 /**
  * Handles authenticating that a user/character is still valid.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function postAuthorized()
 {
     // Get the neccessary headers from the request.
     $service = $this->request->header('service', false);
     $username = $this->request->header('username', '');
     $character = $this->request->header('character', '');
     $this->log->info('A service is attempting to validate a user.', ['username' => $username, 'character' => $character, 'service' => $service]);
     // Verify that the external service exists in the configuration.
     if (!$service || !$this->config->get("addon.auth.{$service}")) {
         $this->log->info(self::ERROR_INVALID_EXTERNAL_SERVICE, ['service' => $service]);
         return $this->failure(self::ERRNO_INVALID_EXTERNAL_SERVICE, self::ERROR_INVALID_EXTERNAL_SERVICE);
     }
     // Check the cache first so the api isn't hammered too badly.
     $key = 'auth:session:' . sha1("{$service}:{$username}");
     if ($this->cache->has($key)) {
         $this->log->info('Returning the cached authorization result.');
         return $this->cache->get($key);
     }
     // Attempt to find the requested user.
     $identifier = filter_var($username, FILTER_VALIDATE_EMAIL) ? 'email' : 'name';
     $user = $this->users->where($identifier, $username)->first() ?: false;
     if (!$user) {
         $this->log->info(self::ERROR_USER_NOT_FOUND);
         return $this->failure(self::ERRNO_USER_NOT_FOUND, self::ERROR_USER_NOT_FOUND);
     }
     // Get and cache the response for 15 minutes.
     $response = $this->getLoginResult($user, $service, $character);
     $this->cache->put($key, $response, $this->carbon->now()->addMinutes(15));
     return $response;
 }
开发者ID:msims04,项目名称:eveseat-addon-auth,代码行数:35,代码来源:AuthController.php

示例8: get

 /**
  * Retrieve an item from the cache by key. If the item is about to expire soon,
  * extend the existing cache entry (for other requests) before returning the item
  *
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  */
 public function get($key, $default = null)
 {
     while ($this->cacheFlagExists($key)) {
         sleep($this->sleep);
     }
     return parent::get($key, $default);
 }
开发者ID:pyrello,项目名称:laravel-extended-cache,代码行数:15,代码来源:Repository.php

示例9: getInstalledThemes

 /**
  * Retrives the installed themes from the cache.
  *
  * If the cahce entry doesn't exist then it is created.
  *
  * @return array
  */
 public function getInstalledThemes()
 {
     $installed = $this->cache->get($this->cacheKey);
     if ($installed !== null) {
         return $installed;
     }
     return $this->findAndInstallThemes();
 }
开发者ID:boomcms,项目名称:boom-core,代码行数:15,代码来源:Manager.php

示例10: makeCacheKey

 /**
  * make a cache key
  *
  * @param string $key
  * @param string $prefix
  * @return string
  */
 private function makeCacheKey($key, $prefix = '')
 {
     $key = md5($prefix . $key);
     $keys = $this->cache->get(self::CACHE_KEYS_KEY, []);
     $keys[$key] = $key;
     $this->cache->forever(self::CACHE_KEYS_KEY, $keys);
     return $key;
 }
开发者ID:rokde,项目名称:laravel-query-analyzer,代码行数:15,代码来源:QueryRepository.php

示例11: getRealmData

 /**
  * @return Realm
  */
 public function getRealmData()
 {
     $that = $this;
     return $this->cache->get('ekko:static:realm', function () use($that) {
         $data = $this->ekko->data()->getRealm();
         $that->cache->add('ekko:static:realm', $data, 60 * 24 * 7);
         return $data;
     });
 }
开发者ID:Itrulia,项目名称:MatchHistory,代码行数:12,代码来源:StaticDataService.php

示例12: image

 public function image(Repository $cache, $id)
 {
     if ($cache->has($id)) {
         return $cache->get($id);
     }
     $card = base64_encode(file_get_contents('http://magiccards.info/scans/en/ori/' . $id . '.jpg'));
     $cache->put($id, $card, 60);
     return $card;
 }
开发者ID:NukaCode,项目名称:Magic,代码行数:9,代码来源:HomeController.php

示例13: saveCachedView

 /**
  * Save a cached view if caching is enabled.
  *
  * @param  \Illuminate\Http\Response  $response
  * @return void
  */
 protected function saveCachedView(Response $response)
 {
     if (config('sitemap.cache_enabled')) {
         $key = $this->getCacheKey();
         $content = $response->getOriginalContent()->render();
         if (!$this->cache->get($key)) {
             $this->cache->put($key, $content, config('sitemap.cache_length'));
         }
     }
 }
开发者ID:shaggyz,项目名称:sitemap,代码行数:16,代码来源:Sitemap.php

示例14: getMatch

 /**
  * @param $matchId
  *
  * @return Match
  */
 public function getMatch($matchId)
 {
     $that = $this;
     $cachKey = 'match:' . $matchId;
     return $this->cache->get($cachKey, function () use($that, $cachKey, $matchId) {
         $match = $that->ekko->matches()->getMatch($matchId, true);
         $match = $that->setStaticData($match);
         $that->cache->put('match:' . $matchId, $match, 3600);
         return $match;
     });
 }
开发者ID:Itrulia,项目名称:MatchHistory,代码行数:16,代码来源:MatchService.php

示例15: replaceVersion

 public function replaceVersion($path)
 {
     $version = $this->cache->get('laravel-asset-versioning.version');
     $file = explode('.', $path);
     $extension = $file[count($file) - 1];
     $types = $this->config->get('assets.types.' . $extension);
     if (isset($types['origin_dir'])) {
         $types = [$types];
     }
     foreach ((array) $types as $type) {
         if (!$type) {
             continue;
         }
         if (!preg_match("#^\\/?" . $type['origin_dir'] . "#", $path)) {
             continue;
         }
         $resource = str_replace($type['origin_dir'], $type['dist_dir'] . '/' . $version, $path);
         $this->addHTTP2Link($resource, $extension);
         return $resource;
     }
     return $path;
 }
开发者ID:escapework,项目名称:laravel-asset-versioning,代码行数:22,代码来源:Asset.php


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