How it works
Runtime code reads settings through get_value(). The following flow applies when a shared cache is configured.
Read contract
- Read
global-config:{key}from Django cache. - Accept only a
GlobalConfigCacheValueDTO. Legacy untyped entries are a miss. - On miss, wait for
global-config:refresh-lock. - After acquiring the lock, re-check the requested key.
- If another process has not published, read every
GlobalConfigrow. - Fail if any declared definition key is missing.
- Parse the full snapshot. One parse failure aborts publish.
- Publish values and the readiness marker with
set_manywhile the lock is still owned. - Resolve the requested key.
SECUREis decrypted only in memory.
Without a shared backend (LocMemCache or DummyCache), get_value() reads the requested row directly. Entries in a shared snapshot have no TTL. A committed save refreshes that key directly; full refresh handles cache-miss recovery and reconciliation.
Refresh triggers
- synchronous cache miss
- targeted refresh of the saved key after
post_saveviatransaction.on_commit() initialize_global_configsafter commit- optional Celery task
django_gc.refresh_global_configs_cache
Initialization suppresses per-row refresh and schedules one full commit-time refresh.
Rows live in the explicit global_configs and global_config_categories
tables. The category table stores only numeric identifiers, while its Admin
labels come from project definitions.