I wrote a pretty small skeleton for my web applications and thought that I would also add a little cache for it.
It is pretty simple:
If the current page exists as a file in the cache and the file is not too old, read it and exit, rather than rebuild the page
If the current page is not cached / outdated, recount the page and save it
However, this is bad:
My performance tests with a page containing 40 relatively long messages through a MySQL query say that using the cache it took even more to process one request (1000 tests each)
How can this happen?
How do I execute a MySQL query, parsing the results for the first time, passing the results to the template, and then repeating the results in the second case faster than checking filemtime()and reading?
filemtime()
Should I just delete the full raw-PHP cache and get rid of the availability of some PHP cache like memcached or so?
Premature optimization is the root of all evil. If you do not need a cache, do not use a cache.
, , - , , PHP - . , PHP, PHP .
, - memcached APC. APC , ( APC , ), memcached , - (/ )
, , - , . :
http://www.mnot.net/cache_docs/
http://blog.digitalstruct.com/2008/02/27/php-performance-series-caching-techniques/
-
apc mysql ( ), php- apc, , mysql . , . , mysql, .
-, squid, , . , mysql memcache, , mysql, - . , , (ob_start) memcache.
, .
- , , .
HTML/PHP, .
Source: https://habr.com/ru/post/1737796/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1737791/sql-rows-to-columns-conversion&usg=ALkJrhiwzN5KAHxlXjx6b2a39JUt-lX7cwIs pdo bug fixed? - pdoCan I develop iPhone apps on Mac without Xcode? - iphoneCreating multiple arrays - javaiPhone: how to launch beta in addition to building the App Store? - iphoneC ++ Win32 Unhandled Exception Handler - c ++Стойка бросает ошибку при попытке обслуживать статический файл - rubyReplacing a backslash with another character in PHP - phpChoose from mysql by day with different time zones (php) - timezoneHow to catch exceptions from another program (for logging)? - c #All Articles