This is useful for sites that have largely static content and are usingmemcached.

## Installation

```` shellpip install sisu-cache-tools````

Then, add `cache_tools` to your project's INSTALLED_APPS in settings.Sisu Cache Tools does not use an database models, so no migration isnecessary, but it must be added to INSTALLED_APPS, or the management commandswill not be found and the signal handlers will not "see" any signals.

## Automated Cache invalidation

To get the automated cache-invalidation, add 'taints_cache = True' as a class-attribute on any models that contain objects that will change the way pagesappear. Using signals, this module will detect changes to those model objectsand invalidate the (entire) cache.

The cache can also be cleared with:

```` shellpython manage.py clearcache````

## Automated Varnish Cache Invalidation (via BAN)

**New from version 0.1.0**

Assuming there are one or more Varnish cache servers with a VCL that includes something like:

and you have configured a list of these servers in settings.CACHE_SERVERS:

```` pythonCACHE_SERVERS = [ 10.0.0.1, 10.0.0.2,]````

and you have django.contrib.sites in use in your settings:

```` pythonINSTALLED_APPS = ( .... 'django.contrib.sites', ....)

...

SITE_ID = 1````

Sisu Cache Tools will then send a DELETE request with the header X-Ban-Host to your Varnish cache servers so that even your remote caches are "cleared" too.

## Pre-emptive Caching

When the operator is done with all of their changes, the might consider using:

```` shellpython manage.py precache````

to make HTTP requests to every page found in the sitemaps defined in theROOT_URLCONF. This will essentially preemptively load the pages into the cacheso your visitors will get speedy access, even if they're the first one to'hit' a given page.