本文整理汇总了PHP中Illuminate\Contracts\Cache\Repository::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getStore方法的具体用法?PHP Repository::getStore怎么用?PHP Repository::getStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Cache\Repository
的用法示例。
在下文中一共展示了Repository::getStore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCacheRepository
/**
* @param Repository $repository
* @throws \Exception
*/
private function setCacheRepository(Repository $repository)
{
if (!$repository->getStore() instanceof TaggableStore) {
throw new \Exception('Cache driver must be extended from Illuminate\\Cache\\TaggableStore ');
}
$this->cache = $repository;
}
示例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;
}
示例3: determineTagSupport
/**
* Detect as best we can whether tags are supported with this repository & store,
* and save our result on the $supportsTags flag.
*
* @return void
*/
protected function determineTagSupport()
{
// Laravel >= 5.1.28
if (method_exists($this->cache, 'tags')) {
try {
// Attempt the repository tags command, which throws exceptions when unsupported
$this->cache->tags($this->tag);
$this->supportsTags = true;
} catch (BadMethodCallException $ex) {
$this->supportsTags = false;
}
} else {
// Laravel <= 5.1.27
if (method_exists($this->cache, 'getStore')) {
// Check for the tags function directly on the store
$this->supportsTags = method_exists($this->cache->getStore(), 'tags');
} else {
// Must be using custom cache repository without getStore(), and all bets are off,
// or we are mocking the cache contract (in testing), which will not create a getStore method
$this->supportsTags = false;
}
}
}
示例4: make
/**
* Make a new cache throttler instance.
*
* @param \GrahamCampbell\Throttle\Data $data
*
* @return \GrahamCampbell\Throttle\Throttlers\CacheThrottler
*/
public function make(Data $data)
{
return new CacheThrottler($this->cache->getStore(), $data->getKey(), $data->getLimit(), $data->getTime());
}