Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 如何缓存结果_Mysql_Caching - Fatal编程技术网

Mysql 如何缓存结果

Mysql 如何缓存结果,mysql,caching,Mysql,Caching,我听说很多大型项目管理员都会缓存结果。我想知道我该怎么做?谢谢 我正在使用PHP。在典型的mysql-PHP环境中,memcached是一个不错的选择 伪逻辑: Test if query result exists in cache If so, retrieve from cache return result else execute query against database transfer results to an array, li

我听说很多大型项目管理员都会缓存结果。我想知道我该怎么做?谢谢


我正在使用PHP。

在典型的mysql-PHP环境中,memcached是一个不错的选择

伪逻辑:

Test if query result exists in cache
If so,
    retrieve from cache 
    return result
else   
    execute query against database   
    transfer results to an array, list or object(s) [dependent on language]
    store results in cache (serialize if necessary)
    return result

通常可以使用memcache或APC(如果您使用的是PHP)来存储缓存,但在必要时可以使用文件。代码将根据您用于缓存的介质而有所不同。

参考:没有足够的信息提供有用的答案。MySQL查询缓存有很好的文档记录,很多人在他们的博客上都对它的用处有不同的看法。你是说缓存查询吗?或者关于缓存结果?哦,对不起,缓存结果,我会在发布时编辑我的帖子。你会有一个自己的大项目,你肯定会知道的。以及当您必须使用缓存时和不使用缓存时。为什么数据库调优应该首先进行