File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
netbox/extras/management/commands Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1+ from django .core .cache import cache
2+ from django .core .management .base import BaseCommand
3+
4+
5+ class Command (BaseCommand ):
6+ """Command to clear the entire cache."""
7+ help = 'Clears the cache.'
8+
9+ def handle (self , * args , ** kwargs ):
10+ cache .clear ()
11+ self .stdout .write ('Cache has been cleared.' , ending = "\n " )
Original file line number Diff line number Diff line change @@ -108,6 +108,11 @@ COMMAND="python3 netbox/manage.py clearsessions"
108108echo " Removing expired user sessions ($COMMAND )..."
109109eval $COMMAND || exit 1
110110
111+ # Clear the cache
112+ COMMAND=" python3 netbox/manage.py clearcache"
113+ echo " Clearing the cache ($COMMAND )..."
114+ eval $COMMAND || exit 1
115+
111116if [ -v WARN_MISSING_VENV ]; then
112117 echo " --------------------------------------------------------------------"
113118 echo " WARNING: No existing virtual environment was detected. A new one has"
You can’t perform that action at this time.
0 commit comments