Add CACHE_ENABLED env var to toggle Redis caching (v2.2.1)
- Set CACHE_ENABLED=false to disable caching without stopping Redis - Defaults to true (caching enabled) - Useful for draft periods requiring real-time data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
254ce2ddc5
commit
e6a325ac8f
@ -26,8 +26,13 @@ logger = logging.getLogger('discord_app')
|
||||
REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost')
|
||||
REDIS_PORT = int(os.environ.get('REDIS_PORT', '6379'))
|
||||
REDIS_DB = int(os.environ.get('REDIS_DB', '0'))
|
||||
CACHE_ENABLED = os.environ.get('CACHE_ENABLED', 'true').lower() == 'true'
|
||||
|
||||
# Initialize Redis client with connection error handling
|
||||
if not CACHE_ENABLED:
|
||||
logger.info("Caching disabled via CACHE_ENABLED=false")
|
||||
redis_client = None
|
||||
else:
|
||||
try:
|
||||
redis_client = Redis(
|
||||
host=REDIS_HOST,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user