فهرست منبع

Add management command for clearing cache

kkthxbye 3 سال پیش
والد
کامیت
7b5625a722
1فایلهای تغییر یافته به همراه11 افزوده شده و 0 حذف شده
  1. 11 0
      netbox/extras/management/commands/clearcache.py

+ 11 - 0
netbox/extras/management/commands/clearcache.py

@@ -0,0 +1,11 @@
+from django.core.cache import cache
+from django.core.management.base import BaseCommand
+
+
+class Command(BaseCommand):
+    """Command to clear the entire cache."""
+    help = 'Clears the cache.'
+
+    def handle(self, *args, **kwargs):
+        cache.clear()
+        self.stdout.write('Cache has been cleared.', ending="\n")