[英]Updating DB table when Mysqli result is cached
On my website there are already many visits daily, so I am thinking about providing the Mysqli Db results from cache.在我的网站上,每天的访问量已经很多,所以我正在考虑从缓存中提供 Mysqli Db 结果。
I am trying it like this:我正在尝试这样:
$res = $mysqli->query("/*" . MYSQLND_QC_ENABLE_SWITCH . "*/" . "SELECT * FROM mytable WHERE id = $id");
while ($res->fetch_assoc()) {...}
If I am not wrong, the first time this query will come from DB and it will be stored to cache.如果我没记错的话,这个查询第一次将来自数据库,它将被存储到缓存中。 And every further call will come from the cache only?并且每个进一步的调用都将仅来自缓存?
And my question is, if I insert another data to that table, will it be shown?我的问题是,如果我在该表中插入另一个数据,它会显示出来吗? Because it is not in the cache.因为它不在缓存中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.