From 85fed6d25d17008161ca2c47bb38b0b639203f2c Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Tue, 10 Dec 2024 14:24:07 -0500 Subject: [PATCH] Clear entire Redis cache on startup if DEBUG=True --- netbox/core/apps.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/netbox/core/apps.py b/netbox/core/apps.py index c5051e922..0811e5cb2 100644 --- a/netbox/core/apps.py +++ b/netbox/core/apps.py @@ -1,4 +1,5 @@ from django.apps import AppConfig +from django.conf import settings from django.core.cache import cache from django.db import models from django.db.migrations.operations import AlterModelOptions @@ -24,5 +25,6 @@ class CoreConfig(AppConfig): # Register models register_models(*self.get_models()) - # Clear Swagger API cache on startup - cache.delete("*api_schema_*") + # Clear Redis cache on startup in development mode + if settings.DEBUG: + cache.clear()