W3C libwww Using

The Cache Manager

Caching is a required part of any efficient Internet access applications as it saves bandwidth and improves access performance significantly in almost all types of accesses. The Library supports two different types of cache: The memory cache and the file cache. The two types differ in several ways which reflects their two main purposes: The memory cache is for short term storage of graphic objects whereas the file cache is for intermediate term storage of data objects. Often it is desirable to have both a memory and a file version of a cached document, so the two types do not exclude each other. The following paragraphs explains how the two caches can be maintained in the Library.

Memory Cache

The memory cache is largely managed by the application as it simply consists of keeping the body part of a document in memory. As the user keeps requesting new documents it will then be served immediately out of memory. This is a nice way to keep high performance while browsing back and forward through the history list. The memory cache is a BEFORE filter that checks whether the data object was kept in memory or flushed.

Persistent Cache

The file cache is intended for intermediate term storage of documents or data objects. The libwww cache is a fully HTTP/1.1 compliant client side cache which honors all HTTP/1.1 cache directives and allows for disconnected operation. The cache also knows how to handle byte range requests so that if you abort a download and start it at a later point in time then it will try to use the part that it already have and only ask for the latter part. In case the origin server (or any interdiate cache) knows how to handle byte range requests we then only get the part that we didn't get the first time.

DocumentationSetting up the Cache

Henrik Frystyk Nielsen, libwww@w3.org,
@(#) $Id: Cache.html,v 1.15 1996/12/09 03:23:38 jigsaw Exp $