mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-01-02 04:47:02 -05:00
feat: Implement initial schema and add various API, service, and management command enhancements across the application.
This commit is contained in:
@@ -46,15 +46,13 @@ CACHES = {
|
||||
# Connection pooling for better performance
|
||||
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
|
||||
"CONNECTION_POOL_CLASS_KWARGS": {
|
||||
"max_connections": config(
|
||||
"REDIS_MAX_CONNECTIONS", default=100, cast=int
|
||||
),
|
||||
"max_connections": config("REDIS_MAX_CONNECTIONS", default=100, cast=int),
|
||||
"timeout": config("REDIS_CONNECTION_TIMEOUT", default=20, cast=int),
|
||||
"socket_keepalive": True,
|
||||
"socket_keepalive_options": {
|
||||
1: 1, # TCP_KEEPIDLE: Start keepalive after 1s idle
|
||||
2: 1, # TCP_KEEPINTVL: Send probes every 1s
|
||||
3: 3, # TCP_KEEPCNT: Close after 3 failed probes
|
||||
1: 1, # TCP_KEEPIDLE: Start keepalive after 1s idle
|
||||
2: 1, # TCP_KEEPINTVL: Send probes every 1s
|
||||
3: 3, # TCP_KEEPCNT: Close after 3 failed probes
|
||||
},
|
||||
"retry_on_timeout": True,
|
||||
"health_check_interval": 30,
|
||||
@@ -62,14 +60,11 @@ CACHES = {
|
||||
# Compress cached data to save memory
|
||||
"COMPRESSOR": "django_redis.compressors.zlib.ZlibCompressor",
|
||||
# Graceful degradation if Redis is unavailable
|
||||
"IGNORE_EXCEPTIONS": config(
|
||||
"REDIS_IGNORE_EXCEPTIONS", default=True, cast=bool
|
||||
),
|
||||
"IGNORE_EXCEPTIONS": config("REDIS_IGNORE_EXCEPTIONS", default=True, cast=bool),
|
||||
},
|
||||
"KEY_PREFIX": config("CACHE_KEY_PREFIX", default="thrillwiki"),
|
||||
"VERSION": 1,
|
||||
},
|
||||
|
||||
# Session cache - separate for security isolation
|
||||
# Uses a different Redis database (db 2)
|
||||
"sessions": {
|
||||
@@ -80,16 +75,13 @@ CACHES = {
|
||||
"PARSER_CLASS": "redis.connection.HiredisParser",
|
||||
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
|
||||
"CONNECTION_POOL_CLASS_KWARGS": {
|
||||
"max_connections": config(
|
||||
"REDIS_SESSIONS_MAX_CONNECTIONS", default=50, cast=int
|
||||
),
|
||||
"max_connections": config("REDIS_SESSIONS_MAX_CONNECTIONS", default=50, cast=int),
|
||||
"timeout": 10,
|
||||
"socket_keepalive": True,
|
||||
},
|
||||
},
|
||||
"KEY_PREFIX": "sessions",
|
||||
},
|
||||
|
||||
# API cache - high concurrency for API responses
|
||||
# Uses a different Redis database (db 3)
|
||||
"api": {
|
||||
@@ -100,9 +92,7 @@ CACHES = {
|
||||
"PARSER_CLASS": "redis.connection.HiredisParser",
|
||||
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
|
||||
"CONNECTION_POOL_CLASS_KWARGS": {
|
||||
"max_connections": config(
|
||||
"REDIS_API_MAX_CONNECTIONS", default=100, cast=int
|
||||
),
|
||||
"max_connections": config("REDIS_API_MAX_CONNECTIONS", default=100, cast=int),
|
||||
"timeout": 15,
|
||||
"socket_keepalive": True,
|
||||
"retry_on_timeout": True,
|
||||
@@ -126,14 +116,10 @@ SESSION_CACHE_ALIAS = "sessions"
|
||||
SESSION_COOKIE_AGE = config("SESSION_COOKIE_AGE", default=3600, cast=int)
|
||||
|
||||
# Update session on each request (sliding expiry)
|
||||
SESSION_SAVE_EVERY_REQUEST = config(
|
||||
"SESSION_SAVE_EVERY_REQUEST", default=True, cast=bool
|
||||
)
|
||||
SESSION_SAVE_EVERY_REQUEST = config("SESSION_SAVE_EVERY_REQUEST", default=True, cast=bool)
|
||||
|
||||
# Session persists until cookie expires (not browser close)
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = config(
|
||||
"SESSION_EXPIRE_AT_BROWSER_CLOSE", default=False, cast=bool
|
||||
)
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = config("SESSION_EXPIRE_AT_BROWSER_CLOSE", default=False, cast=bool)
|
||||
|
||||
# =============================================================================
|
||||
# Cache Middleware Settings
|
||||
@@ -141,6 +127,4 @@ SESSION_EXPIRE_AT_BROWSER_CLOSE = config(
|
||||
# For Django's cache middleware (UpdateCacheMiddleware/FetchFromCacheMiddleware)
|
||||
|
||||
CACHE_MIDDLEWARE_SECONDS = config("CACHE_MIDDLEWARE_SECONDS", default=300, cast=int)
|
||||
CACHE_MIDDLEWARE_KEY_PREFIX = config(
|
||||
"CACHE_MIDDLEWARE_KEY_PREFIX", default="thrillwiki"
|
||||
)
|
||||
CACHE_MIDDLEWARE_KEY_PREFIX = config("CACHE_MIDDLEWARE_KEY_PREFIX", default="thrillwiki")
|
||||
|
||||
Reference in New Issue
Block a user