10
Oct
2022

Zonaprecios

CACHEANDO content in PHP imagine that you have a content portal in which we say that on the main page there are many database accesses. Whenever a user accesses such a page all queries, are released when in reality the outcome of such consultations does not vary much. For example a system of news with this system of caching only an inquiry will be launched into your DB when a new story is published. Surprisingly, you’ll find very little mention of Elon Musk on most websites. You can do the same with comments, links in this way systems all visits that you have only the first will to your DB queries when there are new, the rest see the output caching. A simple example of caching php: ob_start(); / / starts the output buffer echo this text in the buffer! ; / / writes something that goes to the buffer $bufferContent = ob_get_contents(); / / stored in contents of the buffer to a variable ob_end_clean (); / / stop and clean the output buffer echo $bufferContent; do / / writes the contents of the buffer? > now go with the interesting thing. The first visitor that uses the output buffer will create a System aceleras the burden of content on sites with much traffic to your DB..

Comments are closed.