This commit is contained in:
Oscar Plaisant
2024-07-02 03:05:59 +02:00
parent e3df57ccde
commit 626b3a7327
3 changed files with 18 additions and 1 deletions

View File

@@ -11,7 +11,15 @@ import orderankings as odrk
from config import CONFIG, DATABASE_CFG, VENV_HOME, DATABASE_FILE
# persistent memoïzation
memory = Memory(f"{VENV_HOME}/src/cache")
if CONFIG["persistent_query_memoization"]:
memory = Memory(f"{VENV_HOME}/src/cache")
else:
# if memoïzation is disabled, then just use the false memoization decorator
class FalseMemory:
def cache(self, func):
"""This is a decorator that does nothing to its function."""
return func
memory = FalseMemory()
VERBOSE = CONFIG["verbose"]["querying"]