Django provides the following levels of caching listed here by ascending order of granularity:
- Low-level cache API: Provides the highest granularity. Allows you to cache specific queries or calculations.
- Per-view cache: Provides caching for individual views.
- Template cache: Allows you to cache template fragments.
- Per-site cache: The highest-level cache. It caches your entire site.
Think about your cache strategy before implementing caching. Focus first on expensive queries or calculations, which are not calculated on a per-user basis.