Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CoNekT/conekt/controllers/admin/controls/cache.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (19 sloc)
636 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import flash, url_for | |
from conekt.extensions import admin_required | |
from werkzeug.utils import redirect | |
from conekt import cache | |
from conekt.controllers.admin.controls import admin_controls | |
@admin_controls.route('/clear/cache') | |
@admin_required | |
def clear_cache(): | |
""" | |
Touching this endpoint will clear the servers cache (all of it!). | |
:return: Redirect to admin controls | |
""" | |
try: | |
cache.clear() | |
except Exception as e: | |
flash('An error occurred while clearing the cache', 'danger') | |
else: | |
flash('Cache cleared', 'success') | |
return redirect(url_for('admin.controls.index')) |