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'))