django-cachalot
Caches your Django ORM queries and automatically invalidates them.
What it is and what it does
Django Cachalot is a caching layer that sits between your Django ORM and the database, automatically caching query results and invalidating them when the underlying data changes. It works by intercepting ORM queries, storing results in your configured cache backend, and clearing cached entries when INSERT, UPDATE, or DELETE operations occur. The package handles the complexity of cache invalidation automatically, so you don't have to manually manage cache keys.
The package is designed for read-heavy workloads where query patterns are relatively stable. It caches entire table results, which makes it efficient for cold caches or tables with fewer than 50 modifications per minute. For rapidly-changing data, cache invalidation overhead can become significant since the entire table cache is cleared on any write. It integrates directly into Django's ORM without requiring code changes to your queries—just add it to INSTALLED_APPS and configure your cache backend.
Use it for:
- Reduce database load in read-heavy applications by caching frequently-accessed ORM query results automatically.
- Speed up initial page loads and API responses by caching the results of select_related and prefetch_related queries.
- Simplify cache management in Django projects by eliminating manual cache key creation and invalidation logic.
- Improve performance for applications with stable query patterns and infrequent data modifications.
- Debug caching behavior in Django admin and development tools via the optional django-debug-toolbar integration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically caches Django ORM queries and invalidates them when data changes, reducing database load for read-heavy applications.
Yes, if your Django application is read-heavy with stable query patterns and fewer than 50 modifications per minute on cached tables. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a safe choice. Skip it if your workload involves frequent writes to large tables, as cache invalidation overhead will outweigh the benefit.
Install
django-cachalot on PyPI
pip
pip install django-cachalotuv
uv add django-cachalotpoetry
poetry add django-cachalotInstalling django-cachalot
Before you install
Installation is straightforward with low friction—a pure Python wheel with only Django as a runtime dependency. The project is actively maintained with a recent release (4 days old) and steady commit activity, making it a stable choice for production use.
License in practice
Licensed under BSD (permissive), so you can use, modify, and distribute this package freely in commercial and open-source projects without significant legal constraints.
Quickstart
pip install django-cachalot
# In settings.py, add to INSTALLED_APPS:
INSTALLED_APPS = [
'cachalot',
# ...
]
# Then use Django ORM normally—caching is automatic:
from Django import models
results = models.Model.objects.all() # Cached automatically
Requires a cache backend configured in Django settings. Clock synchronization across multiple servers is required if using a shared cache.
Verify before relying
- Whether clock synchronization issues across multiple cache servers are resolved automatically or require manual intervention beyond what the documentation describes.
- Performance characteristics when caching tables modified more than 50 times per minute, and whether the stated limitations apply to your specific workload.
- Whether local memory caching works effectively for single-process deployments or if a dedicated cache backend is strictly required.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Django |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 263,609/month — #8,352 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_cachalot-2.9.1-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
django-cacheopsAutomatic and manual ORM query caching for…
permissive · top 5,000 on PyPI
django-memoizeCaches function and method results in Django…
permissive · top 15,000 on PyPI
dbt-statedbt-state is a dbt plugin that caches model…
permissive · top 15,000 on PyPI
django-picklingSpeeds up Django model pickling by 2-3 times…
permissive · top 15,000 on PyPI
django-cache-memoizeA decorator that caches function results using…
copyleft · top 15,000 on PyPI
CollectfastaCollectfasta speeds up Django's collectstatic…
permissive · top 5,000 on PyPI
django-cache-urlConfigures Django cache backends from…
permissive · top 15,000 on PyPI
CollectfastCollectfast accelerates Django's collectstatic…
permissive · top 15,000 on PyPI
django-redisProvides a Redis cache and session backend for…
permissive · top 5,000 on PyPI
tortoise-ormTortoise ORM is an async-native…
permissive · top 15,000 on PyPI