When a client requests a web page or document from the proxy server, the proxy server copies the document from the remote server to its local cache directory structure while sending the document to the client.
When a client requests a document that was previously requested and copied into the proxy cache, the proxy returns the document from the cache instead of retrieving the document from the remote server again as shown in the following figure. If the proxy determines that the file is not up to date, the proxy refreshes the document from the remote server and updates its cache before sending the document to the client.
Files in the cache are automatically maintained by the Sun Java System Web Proxy Server garbage collection utility (CacheGC). The CacheGC automatically cleans the cache on a regular basis to ensure that the cache does not get cluttered with out-of-date documents.