41.2.2 Managing web pages

Http also provides OTcl interfaces to manage a set of pages. The real management of pages are handled by class PagePool and its subclasses. Because different HTTP objects have different requirements for page management, we allow different PagePool subclasses to be attached to different subclasses of Http class. Meanwhile, we export a common set of PagePool interfaces to OTcl through Http. For example, a browser may use a PagePool only to generate a request stream, so its PagePool only needs to contain a list of URLs. But a cache may want to store page size, last modification time of every page instead of a list of URLs. However, this separation is not clearcut in the current implementation.

Page URLs are represented in the form of: ServerName:SequenceNumber where the ServerName is the name of OTcl object, and every page in every server should have a unique SequenceNumber. Page contents are ignored. Instead, every page contains several attributes, which are represented in OTcl as a list of the following (name value) pairs: ``modtime val'' (page modification time), ``size val'' (page size), and ``age val''} The ordering of these pairs is not significant.

Following is a list of related OTcl methods.

rX set-pagepool pagepool & set page pool

enter-page pageid attributes & add a page with id $pageid into pool. $attributes is the attributes of $pageid, as described above.

get-page pageid & return page attributes in the format described above.

get-modtime pageid & return the last modification time of the page $pageid.

exist-page pageid & return 0 if $pageid doesn't exist in this Http object, 1 otherwise.

get-size pageid & return the size of $pageid.

get-cachetime pageid & return the time when page $pageid is entered into the cache.

Tom Henderson 2011-11-05