Skip to content
Permalink
170b47692b
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
24 lines (19 sloc) 636 Bytes
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'))