skillfed

django-cachalot

Caches your Django ORM queries and automatically invalidates them.

django-cachalot v2.9.1 263.6K downloads/30d#8,352 on PyPI1,428
Permissive license BSD Active released

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-cachalot

uv

uv add django-cachalot

poetry

poetry add django-cachalot

Installing 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

Development Status :: 5 - Production/StableFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP

Tags

django orm query cachingautomatic cache invalidationdjango database query cachereduce django database hitsorm result cachingdjango performance optimizationquery result memoization
django-ormquery-cachingperformance

More WWW/HTTP packages