feat: scaffold Django multi-tenant project with 5 of 9 apps
Phase 1 scaffolding: config/, core/, base models, AES-256-GCM phone encryption, enums mirror apps.tenant: Tenant + Domain (django-tenants) apps.org: 11 models (OrgUnit hierarchy, Staff, audit logs) apps.account: 4 models (UserAccount as AUTH_USER_MODEL, login/password tracking) apps.permission: 7 models (RBAC + overrides + datascope + append-only changelog) apps.region: 5 models (District, BusinessArea, MetroLine, MetroStation, School) All migrations generated, manage.py check passes
This commit is contained in:
17
core/cache.py
Normal file
17
core/cache.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
def get_redis_key(tenant_schema: str, module: str, key: str) -> str:
|
||||
return f"{tenant_schema}:{module}:{key}"
|
||||
|
||||
|
||||
def cache_get(tenant_schema: str, module: str, key: str, default=None):
|
||||
return cache.get(get_redis_key(tenant_schema, module, key), default)
|
||||
|
||||
|
||||
def cache_set(tenant_schema: str, module: str, key: str, value, timeout: int = 300) -> None:
|
||||
cache.set(get_redis_key(tenant_schema, module, key), value, timeout)
|
||||
|
||||
|
||||
def cache_delete(tenant_schema: str, module: str, key: str) -> None:
|
||||
cache.delete(get_redis_key(tenant_schema, module, key))
|
||||
Reference in New Issue
Block a user