TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Caching MySQL queries

6 点作者 sangguine将近 17 年前
Hi. memcached is not really good for MySQL. Then, what is a good way or practice to cache MySQL queries? Do you recommend any reading on caching?

4 条评论

bigbee将近 17 年前
The easiest way is to use MySQL's own query cache. Increasing its size yields wonderful results.<p>On linux, edit my.cnf and add the following:<p><pre><code> [mysqld] ... query_cache_type=1 query_cache_limit=1M query_cache_size=128M # or more - depends on you total available RAM key_buffer=128M # or more </code></pre> Note that you'll need to restart mysql to make these changes count
andrewf将近 17 年前
The biggest thing you need to sort out when caching is exactly how well synced your cache needs to be.<p>Once you've written fresh data to the database, is it okay for you to keep receiving stale data in response to later queries?<p>If you've got multiple web servers, do they all have to return the same data, or is it okay if some lag behind the others?<p>If you're happy to serve stale (versus some tunable time metric) data inconsistently across different servers, then just find a database client library that does client-side result set caching (ADODB for PHP will do this, either in the filesystem or against memcache) and run with it.
gtani将近 17 年前
<a href="http://www.databasejournal.com/features/mysql/article.php/3110171" rel="nofollow">http://www.databasejournal.com/features/mysql/article.php/31...</a> <a href="http://dev.mysql.com/doc/refman/5.0/en/query-cache-how.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/query-cache-how.html</a> <a href="http://www.mysqlperformanceblog.com/2008/01/29/how-mysql-query-cache-works-with-transactions/" rel="nofollow">http://www.mysqlperformanceblog.com/2008/01/29/how-mysql-que...</a>
aaroneous将近 17 年前
What do you mean memcached is not good for MySQL?
评论 #206464 未加载