Jump to content

Web Caching


[dx]

Recommended Posts

Hi, I'm not really sure if this is good section for this topic, but I choosed this couse it looks familiar to me. I've read some web caching tutorials, but everything looks a lil bit confusing to me. Which configuration is the best for PHP's headers, or HTML's meta tags? What does cache really stores? All data? Just images? So if I have dinamic page which uses SQL, and those data may be, or not changed for some time, what should I do? Does it checks cache for tooken data with name, or whatever, and if there's not some image, data etc. on our PC, it downloads it, and if there's it reads it from cache. Can you add some additional info, and examples? Regards

Link to comment
Share on other sites

"Cache" is just a generic term for something which bypasses a direct path for a more efficient one. Whether it's caching files on the client (bypassing the direct contact with the web server) or a PHP opcode cache (to bypass the PHP parser and compiler) or a web server's "output cache" (to bypass PHP and other dynamic stuff altogether).The trick about caching is to ensure you cache things which would rarely be modified, and ensure that if they're modified, the cache will update accordingly. The details vary depending on what cache are we talking about.

Link to comment
Share on other sites

How to work with data on page? Lets say we have text (which is changed with mysql often) and images. So how we will update just text without images etc. It's a lil bit confusing.

Link to comment
Share on other sites

Each "resource" (image, HTML page, CSS file, JavaScript file, etc.) is downloaded separately. That is, with a separate HTTP request. You can set up different caching options for each HTTP request.(BTW, for each request, your browser gets a response; a response is made of headers, followed by a body; the headers are information that your browser uses for its own needs, such as caching, whereas the body is what you see in your browser)By default, Apache sends "Last-Modified" headers in all requests to static files, so that the image is only downloaded again if it was modified. However, an HTTP request is still sent with the time the image was downloaded at, so that the web server either explicitly says "Not modified" or gives the new file. You can eliminate this request completely if you add an "Expires" header. With it, a request is sent only if the time specified in the Expires header has passed.To make proper Expires generation easy, Apache has mod_expires.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...