Introduction

Autocache addresses two of the most common scenarios for caching and cache invalidation for django models: instance caching and related objects caching.

Instance Caching

This is the practice of caching individual model instances. Autocache provides a CacheController that you can attach to models to cause automatic caching and invalidations.

class Model(django.models.Model):
    cache = autocache.CacheController()
    field = django.models.TextField()

Model.objects.get(pk=27)    # hits the database
Model.cache.get(27)         # Tries cache first

Table Of Contents

Previous topic

Welcome to the Django-Autocache Documenation

Next topic

Examples

This Page