A mechanism for caching dynamically generated content is disclosed,
wherein initially, a server receives a request from a client for a set of
dynamically generated content. In response to the request, the server
accesses a cached version of the requested content, which was generated
previously, and determines whether the cached version is still valid. If
the cached version is no longer valid (e.g. is out of date), then the
requested content is dynamically generated and stored in a cache,
replacing the outdated version. In addition, the freshly generated
content is provided to the client in response to the request. The client
is thus provided with the most current information. On the other hand, if
the cached version is still valid, then the server foregoes generating
the content. Instead, it provides the cached version of the content to
the client. By doing so, the server reduces the time required to return
the content to the client, and significantly improves system performance.