Jump to content
Sign in to follow this  
[dx]

Web Caching

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

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...