From 243a9b6fd9a82cce595dadf9dce7a1ca85bf5a08 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 29 Jul 2021 11:30:13 +0300 Subject: [PATCH] added cli: flask clear-cache --- scodoc.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scodoc.py b/scodoc.py index 06c6f3df77..8760e93bd8 100755 --- a/scodoc.py +++ b/scodoc.py @@ -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.")