[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>
This commit is contained in:
Markus Heiser
2025-09-24 19:34:03 +02:00
committed by Markus Heiser
parent 4f4de3fc87
commit 18a58943cc
4 changed files with 131 additions and 40 deletions

20
searx/data/__main__.py Normal file
View File

@@ -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()