0

For performance, some Web pages get cached. This is because the server can then speed up page load time:

Without a cached copy

+--SERVER--+                                                   +--CLIENT--+
| [file] --> load file from disk --> read file --> sends over --> loaded  |
+----------+                                                   +----------+

With a cached copy
+--SERVER--+                                             +--CLIENT--+
| [file] --> read file from cache --> sends over network --> loaded |
+----------+                                             +----------+

This speeds up the operation.

However, when a file changes, the cache does not change. Even though the cache can speed up load time by a lot, the file is still old. The Web site has to regenerate the cache again.

So why do Web servers cache pages even though the file will have to change in the future?

1
  • 1
    The answer is speed and/or reducing server load as serving a static/cached page is a lot less cpu intensive then recreating it on demand. That said there are different types of caches/caching mechanisms (eg reverse proxies, wordpress plugins, server directives, cdns) with different focusses- which one are you asking about?
    – davidgo
    May 25 at 2:57
1

Even if the text content on the page changes the cache should store images and CSS that render the page. And while you are on the same page it doesn’t make sense to load the logo over and over.

2
  • What if the logo changes under rare conditions? May 25 at 1:29
  • 1
    As long as it takes for logos to get redesigned the cache will expire before then.
    – keepkalm
    May 25 at 1:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.