Support the caches logic introduced in Django 1.7.

Closes #643