[英]Flush all cache in Laravel 4
有沒有辦法刷新Laravel 4中的所有緩存? 我正在使用文件進行緩存。 我在文檔上看到你可以使用Cache::forget('key')
,但如果我需要刪除所有緩存怎么辦?
工匠命令也很有用,我認為回購上有一個問題,但不確定它是否已經實現。
謝謝!
如果你運行php artisan list
然后你可以找到artisan
可用的所有命令,無論如何,有一個清除cache
的命令,它是
php artisan cache:clear
另外,你可以使用
foreach (Cache::getMemory() as $cacheKey => $cacheValue)
{
Cache::forget($cacheKey);
}
更新:
Cache::flush();
Illuminate\\Cache\\FileStore
具有flush
功能,因此您可以使用:
Cache::flush();
使用,
use Doctrine\Common\Cache\CacheProvider as DoctrineCache;
DoctrineCache::flushAll();
刷新所有緩存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.