本文整理汇总了PHP中Illuminate\Cache\Repository::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::has方法的具体用法?PHP Repository::has怎么用?PHP Repository::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Cache\Repository
的用法示例。
在下文中一共展示了Repository::has方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: has
/**
* Determine if an item exists in the cache.
*
* @param mixed $key
* @return mixed
*/
public function has($key)
{
if (is_array($key)) {
return $this->hasMany($key);
}
return parent::has($key);
}
示例3: 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;
}
示例4: 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;
}
示例5: getCachedView
/**
* Check to see whether a view has already been cached for the current
* route and if so, return it.
*
* @return mixed
*/
protected function getCachedView()
{
if (config('sitemap.cache_enabled')) {
$key = $this->getCacheKey();
if ($this->cache->has($key)) {
return $this->cache->get($key);
}
}
return false;
}
示例6: has
/**
* Determine if an item exists in the cache.
*
* @param string $key
* @return bool
* @static
*/
public static function has($key)
{
return \Illuminate\Cache\Repository::has($key);
}
示例7: has
/**
* @param string $key
*
* @return bool
*/
public function has($key)
{
return $this->cache->has($key);
}
示例8: verifyToken
/**
* Verify the given token for a valid user.
*
* @param string $token
*
* @return boolean
*/
public function verifyToken($token)
{
return $this->cache->has($this->getCacheKey($token));
}
示例9: has
/**
* @param $key
* @return bool
*/
public function has($key)
{
return $this->enabled ? $this->cache->has($key) : false;
}
示例10: has
/**
* Determine if an item exists in the cache.
*
* @param string $key
* @return bool
*/
public function has($key)
{
if (!$this->operatingOnKeywords()) {
$this->resetCurrentKeywords();
}
return parent::has($key);
}
示例11: hasCachedPlugins
/**
* 캐싱된 플러그인 정보가 있는지 조사한다.
*
* @return bool
*/
public function hasCachedPlugins()
{
return $this->cache->has($this->cacheKey);
}
示例12: isExistCachedSiteInstanceRoutes
/**
* isExistCachedSiteInstanceRoutes
*
* @param string $siteKey key of to confirm exist site instance routes
*
* @return bool
*/
public function isExistCachedSiteInstanceRoutes($siteKey)
{
if ($this->debugMode) {
return false;
}
$keyString = $this->getSiteCacheKeyString($siteKey);
return $this->cache->has($keyString);
}
示例13: cacheHas
/**
* Check a setting exists in cache
*
* @param string $key
*
* @return boolean
*/
public function cacheHas($key)
{
return $this->cache->has($this->attachTag($key)) ? true : false;
}
示例14: hasItem
/**
* Check if cache entry exists
*
* @param string $key
*
* @return bool
*/
public function hasItem($key)
{
$key = $this->getKey($key);
return $this->cacheRepository->has($key);
}