Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
noripyt#135 Have the table key generation look for a "CACHE_KEY" configuration in the Django DATABASES configs. If a "CACHE_KEY" value is found, then we use that instead of the "db_alias". This allows us to synch Master and Replicas to use the same key namespace to prevent "double-caching" and the need to invalidate 2 cache entries upon an update. The Django configuration would look like: DATABASES = { 'master': { 'CACHE_KEY': 'WE_ARE_ONE', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': DB_NAME, 'USER': DB_USER, 'PASSWORD': DB_PASSWORD, 'HOST': DB_HOST, 'PORT': DB_PORT, 'OPTIONS': { 'client_encoding': "UTF8" } }, 'replica' : { 'CACHE_KEY': 'WE_ARE_ONE', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': DB_NAME, 'USER': DB_USER, 'PASSWORD': DB_PASSWORD, 'HOST': DB_HOST, 'PORT': DB_PORT, 'OPTIONS': { 'client_encoding': "UTF8" } } }
- Loading branch information