有没有办法注入laravel缓存系统并访问增量方法。
\Cache::increment('key');
到目前为止,我有以下内容,但没有增加方法。
/**
* @var Cache\Repository
*/
protected $cache;
/**
* RateLimiter constructor.
*
* @param Cache\Repository $cache
*/
public function __construct(Cache\Repository $cache)
{
$this->cache = $cache;
}我尝试过注入Cache\Store,但这不是可实例化的
编辑:
use Illuminate\Contracts\Cache;没有在上面的摘录中显示,但它在那里。
有什么建议吗?
发布于 2015-07-17 22:35:02
根据official docs的说法,Cache外观的下划线类是Illuminate\Cache\Repository,而不是Cache\Repository
https://stackoverflow.com/questions/31478145
复制相似问题