summaryrefslogtreecommitdiff
path: root/searx/data/__main__.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2025-09-24 19:34:03 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-09-28 07:32:41 +0200
commit18a58943ccaa324b39232fa503462eb39f407399 (patch)
tree04b355ad60c205b28ea1083ea97abdfabea857ff /searx/data/__main__.py
parent4f4de3fc8743b3732834c5ffaa4a3e264d200e6c (diff)
[mod] ExpireCacheSQLite - implement .setmany() for bulk loading
[1] https://github.com/searxng/searxng/issues/5223#issuecomment-3328597147 Suggested-by: Ivan G <igabaldon@inetol.net> [1] Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
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()