Excluding urls from the cache

Sometimes you don’t want urls to be cached for various reasons (they can pull content from external sites with no way to invalidate the local cache, or they are just non meant to be available offline).

django-html5-appcache provides different ways to exclude urls from cache to meet as many usecases as possible.

Configuration

To statically exclude urls from cache or add to the fallback section, use HTML5_APPCACHE_NETWORK_URL and HTML5_APPCACHE_NETWORK_URL.

AppCache class

In the AppCache classes, is it possible to override BaseAppCache._get_fallback and BaseAppCache._get_network to fine-tune the urls in each section of the manifest file.

Markup

When using sitemap, by default every relative URL is considered to be cached, while external URLs are not cached. It’s possible to control the behavior of each url by using custom attributes in your tags.

For each img, script and link tag, you can add data-attributes to control how each referenced url is considered:

  • data-appcache=’noappcache’: the referenced url is added to the NETWORK section
  • data-appcache-fallback=URL: the referenced url is added in the FALLBACK section, with URL as a target
Read the Docs v: 0.3.1
Versions
latest
0.4.0
0.3.1
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.