O'Reilly logo

HTTP: The Definitive Guide by Brian Totty, Marjorie Sayer, Sailu Reddy, Anshu Aggarwal, David Gourley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cache Processing Steps

Modern commercial proxy caches are quite complicated. They are built to be very high-performance and to support advanced features of HTTP and other technologies. But, despite some subtle details, the basic workings of a web cache are mostly simple. A basic cache-processing sequence for an HTTP GET message consists of seven steps (illustrated in Figure 7-11):

  1. Receiving—Cache reads the arriving request message from the network.

  2. Parsing—Cache parses the message, extracting the URL and headers.

  3. Lookup—Cache checks if a local copy is available and, if not, fetches a copy (and stores it locally).

  4. Freshness check—Cache checks if cached copy is fresh enough and, if not, asks server for any updates.

  5. Response creation—Cache makes a response message with the new headers and cached body.

  6. Sending—Cache sends the response back to the client over the network.

  7. Logging—Optionally, cache creates a log file entry describing the transaction.

Processing a fresh cache hit

Figure 7-11. Processing a fresh cache hit

Step 1: Receiving

In Step 1, the cache detects activity on a network connection and reads the incoming data. High-performance caches read data simultaneously from multiple incoming connections and begin processing the transaction before the entire message has arrived.

Step 2: Parsing

Next, the cache parses the request message into pieces and places the header parts in easy-to-manipulate data structures. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required