summaryrefslogtreecommitdiff
path: root/searx/data/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/data/__main__.py')
-rw-r--r--searx/data/__main__.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/searx/data/__main__.py b/searx/data/__main__.py
new file mode 100644
index 000000000..8e7852751
--- /dev/null
+++ b/searx/data/__main__.py
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+"""Command line implementation"""
+
+import typer
+
+from .core import get_cache
+
+app = typer.Typer()
+
+
+@app.command()
+def state():
+ """show state of the cache"""
+ cache = get_cache()
+ for table in cache.table_names:
+ for row in cache.DB.execute(f"SELECT count(*) FROM {table}"):
+ print(f"cache table {table} holds {row[0]} key/value pairs")
+
+
+app()