added cli: flask clear-cache

This commit is contained in:
Emmanuel Viennet 2021-07-29 11:30:13 +03:00
parent 8c02c6ef7e
commit 243a9b6fd9
1 changed files with 15 additions and 0 deletions

View File

@ -184,3 +184,18 @@ def user_db_import_scodoc7(): # user-db-import-scodoc7
The original SCOUSERS database is left unmodified.
"""
utils.import_scodoc7_user_db()
@app.cli.command()
@with_appcontext
def clear_cache(): # clear-cache
"""Clear ScoDoc cache
This cache (currently Redis) is persistent between invocation
and it may be necessary to clear it during developement or tests.
"""
# attaque directement redis, court-circuite ScoDoc:
import redis
r = redis.Redis()
r.flushall()
click.echo("Redis caches flushed.")