Next: , Up: General Facilities

5.1 Disk Caching

The disk cache stores retrieved documents locally, whence they can be retrieved more quickly. When requesting a URL that is in the cache, the library checks to see if the page has changed since it was last retrieved from the remote machine. If not, the local copy is used, saving the transmission over the network. Currently the cache isn't cleared automatically.

— User Option: url-automatic-caching

Setting this variable non-nil causes documents to be cached automatically.

— User Option: url-cache-directory

This variable specifies the directory to store the cache files. It defaults to sub-directory cache of url-configuration-directory.

— User Option: url-cache-creation-function

The cache relies on a scheme for mapping URLs to files in the cache. This variable names a function which sets the type of cache to use. It takes a URL as argument and returns the absolute file name of the corresponding cache file. The two supplied possibilities are url-cache-create-filename-using-md5 and url-cache-create-filename-human-readable.

— Function: url-cache-create-filename-using-md5 url

Creates a cache file name from url using MD5 hashing. This is creates entries with very few cache collisions and is fast.

          (url-cache-create-filename-using-md5 "")
            ⇒ "/home/fx/.url/cache/fx/http/com/example/www/b8a35774ad20db71c7c3409a5410e74f"
— Function: url-cache-create-filename-human-readable url

Creates a cache file name from url more obviously connected to url than for url-cache-create-filename-using-md5, but more likely to conflict with other files.

          (url-cache-create-filename-human-readable "")
            ⇒ "/home/fx/.url/cache/fx/http/com/example/www/foo/bar"
— Function: url-cache-expired

This function returns non-nil if a cache entry has expired (or is absent). The arguments are a URL and optional expiration delay in seconds (default url-cache-expire-time).

— User Option: url-cache-expire-time

This variable is the default number of seconds to use for the expire-time argument of the function url-cache-expired.

— Function: url-fetch-from-cache

This function takes a URL as its argument and returns a buffer containing the data cached for that URL.