$this->getCachedCategories();//Above code Stores the data in cache for future use. So, it goes to the database only //one time and next time pick the data from cache. So far everything is good.//I have a search criteria which is in the form of array. I filter above cache data based //upon the search criteria and gets the data.foreach ($userInputsForFilter as $key => $value) { $this->Categories = $this->Categories->where($key, $value);}這是屏幕截圖。如果您注意到檢索到的數(shù)據(jù)的第一個索引是 1 而不是 0。實際上第二個記錄是在過濾緩存數(shù)據(jù)后出現(xiàn)的。你能告訴為什么在搜索緩存數(shù)據(jù)時會發(fā)生這種情況嗎?轉(zhuǎn)到數(shù)據(jù)庫時不會發(fā)生這種情況。數(shù)組到 JSON 代碼$CategoryResponse = $this->iCategory->All([], []);return \Response::json($CategoryResponse, 200);
在緩存數(shù)據(jù)中搜索給出數(shù)組第一個索引 1
寶慕林4294392
2021-09-05 16:58:14