当我在 CodeIgniter 中进行查询缓存时,$this->db->cache_on();
它将创建文件夹和文件,controller+method
例如以show+73
. 但是当我从表中删除具有 73 id 的行并$this->db->cache_delete('show', $id);
用于删除缓存时,它也不起作用。它存在并在我调用时返回响应我show/73
应该如何解决它?
我的代码:
返回结果(在模型中)
public function temp($id)
{
$this->db->cache_on();
$this->db->where('id',$id);
$query = $this->db->get('system_store_table');
return $query->result();
}
从表中删除行和缓存。(它会成功从表中删除行,但不能删除它的缓存)
public function delete($id = 0)
{
$this->db->flush_cache();
$this->db->where('id',$id);
$this->db->delete('system_store_table');
$this->db->cache_delete('show', $id);
if ($this->db->affected_rows() != 0)
return TRUE;
return FALSE;
}