-
Notifications
You must be signed in to change notification settings - Fork 0
Cache
Django's cache API is always available, while CACHE_BACKEND selects its implementation.
Application code should use django.core.cache.cache and should not inspect the selected backend.
Caching is disabled by default:
CACHE_BACKEND=dummyThe dummy backend accepts cache operations but never stores values. Application correctness must not depend on cached data.
Use local memory for development or a single-process deployment:
CACHE_BACKEND=locmemEach process has a separate cache. Do not use this mode when workers need shared values.
The local Compose stack starts Redis, exposes it on port 6379, and configures the web service to use it.
Install the optional cache dependency:
uv sync --group cacheConfigure Redis running on the host:
CACHE_BACKEND=redis
CACHE_URL=redis://127.0.0.1:6379/1For a Redis service named redis on a Compose network, use:
CACHE_URL=redis://redis:6379/1The application fails during startup when Redis mode has no URL. Redis connection failures do not silently fall back to process-local memory.
Django Boilerplate