# Cache Filter

The Cache Filter provides client side caching support for the HTTP protocol. The cache is as much as possible HTTP/1.1 compliant and can be used either by standalone browsers,or by a proxy (the typical case when you use Jigsaw).

When this filter is used throughout Jigsaw proxy, it is best (ie read recommended) to use the appropriate resources to configure it (instead of setting manually the properties). In that case, the CacheProp resource.

## Properties

The CacheFilter defines the following properties:

- w3c.www.protocol.http.cache.size
- w3c.www.protocol.http.cache.debug
- w3c.www.protocol.http.cache.shared
- w3c.www.protocol.http.cache.directory
- w3c.www.protocol.http.cache.connected
- w3c.www.protocol.http.cache.garbageCollectionEnabled
- w3c.www.protocol.http.cache.fileSizeRatio

`w3c.www.protocol.http.cache.size`

semantics
  The size of the cache, expressed in bytes.
type
  An integer property
default value
  This property defaults to 5000000 bytes, ie 5Mb

`w3c.www.protocol.http.cache.debug`

semantics
  Will make the CacheFIlter emit some (hopefully) usefull traces.
type
  A boolean property
default value
  This property defaults to false.

`w3c.www.protocol.http.cache.shared`

semantics
  Is this cached shared among several users ? Some of HTTP/1.1 caching semantics depends on wether the cache is shared or not, this flag will change the caching policy accordingly.
type
  A boolean property.
default value
  This property defaults to false.

`w3c.www.protocol.http.cache.directory`

semantics
  The directory that the cache should use to store cached content. If not provided the directory defaults to the `.web_cache` under the current user's home directory. Note that when used through Jigsaw the cache directory will automatically be set to `config/cache` where `config` is the main Jigsaw configuration repository.
type
  A File property (should provide the path of a directory in the file system)
default value
  See above.

`w3c.www.protocol.http.cache.connected`

semantics
  Should the cache consider itself connected to the Internet ? The cache filter can be used in disconnected mode, in which case it will only look for document in the cache, and if not found, will emit the appropriate HTTP/1.1 error reply.
  You may experience funny results when disconnecting the cache from the Internet, most of them are the results of content providers not providing the appropriate informations (and some time, even intentionnaly).
type
  A boolean property
default value
  This property defaults to true.

`w3c.www.protocol.http.cache.garbageCollectionEnabled`

semantics
  Should the cache try to run its garbage collector ? This flag is intended to be used when the user's is planning to disconnect the cache. By setting the flag to false, he/she can safely browse the web and everything he/she visits will enter the cache (for latter consumption) and stay there.
  An interesting project, of course, would be to write a robot to fill the cache automatically (stay tuned, or write it !)
type
  A boolean property
default value
  This property defaults to true.

`w3c.www.protocol.http.cache.fileSizeRatio`

semantics
  The ratio to the total cache size that a single entry in the cache is allowed to occupy.
type
  A double property (a ratio between 0 and 1 indicating how much of the total cache space a single cached entry is able to occupy).
default value
  This property defaults to 0.1 (which means that if you are using the default cache size of 5Mb, only file smaller than 500Kb are candidate to enter the cache)

Jigsaw Team
$Id: w3c.www.protocol.http.cache.CacheFilter.html,v 1.2 1997/07/31 08:25:42 ylafon Exp $