Publishing Engine Programmer's Guide > The Arbortext Publishing Engine Request Manager > Customizing the Arbortext PE Request Manager > Writing a Custom Cache Manager > Implementing a Cache Manager > The cache Method
  
The cache Method
The Arbortext PE Request Manager calls the cache method if these conditions are met:
A response to a request has been produced by a request handler and the response is not an error.
The search method returned a cache entry with a status of CACHEABLE.
The cache method takes an HTTP request and an HTTP response as parameters. The cache manager should copy the response and store it in its data structures, with as much data from the request as necessary, so that it can return a cache entry that contains the HTTP response and status IN_CACHE next time the search method receives a similar request.
The cache method should make a copy of the HTTP response object; it should not retain a reference to the response object itself, because the response object is allocated by the servlet container and might, depending upon implementation, be reused after transmission to the client. Similarly, if the response object refers to a file on disk, the cache method should make a copy of the file in question; there's no way for the cache method to be sure that the file won't be deleted or reused while the cache manager references it.