如題
仍需要 composer require -W illuminate/redis 否則報(bào)錯(cuò)
另外一個(gè)問(wèn)題是關(guān)于使用 array 類(lèi)型緩存
public static function index()
{
$cacheKey = 'watchlist';
if (!Cache::has($cacheKey)) {
//從數(shù)據(jù)庫(kù)中返回第一條數(shù)據(jù)
//重啟webman 后 不走這里. 我非常疑惑..內(nèi)存里一直有這個(gè)?不會(huì)因?yàn)閣ebman停止銷(xiāo)毀.
Cache::set($cacheKey, Mch::first());
}
return Cache::get($cacheKey);
}
通過(guò)查看redis 有這數(shù)據(jù),我這才明白 ARRAY 是存如redis的
回頭看文檔,文檔誤我..查看源碼 但單例初始化的是redis的適配器.