From 966cd4622823f46bf3dc730696189fa42d0dcd5b Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Thu, 23 Oct 2025 22:05:36 +0000 Subject: [PATCH] Add management command to clear diagram cache Usage: python manage.py clear_diagram_cache python manage.py clear_diagram_cache --type plantuml --- .../commands/clear_diagram_cache.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 abschnitte/management/commands/clear_diagram_cache.py diff --git a/abschnitte/management/commands/clear_diagram_cache.py b/abschnitte/management/commands/clear_diagram_cache.py new file mode 100644 index 0000000..035b466 --- /dev/null +++ b/abschnitte/management/commands/clear_diagram_cache.py @@ -0,0 +1,23 @@ +from django.core.management.base import BaseCommand +from diagramm_proxy.diagram_cache import clear_cache + + +class Command(BaseCommand): + help = 'Clear cached diagrams' + + def add_arguments(self, parser): + parser.add_argument( + '--type', + type=str, + help='Diagram type to clear (e.g., plantuml, mermaid)', + ) + + def handle(self, *args, **options): + diagram_type = options.get('type') + if diagram_type: + self.stdout.write(f'Clearing cache for {diagram_type}...') + clear_cache(diagram_type) + else: + self.stdout.write('Clearing all diagram caches...') + clear_cache() + self.stdout.write(self.style.SUCCESS('Cache cleared successfully'))