Skip to content

Commit 04e4f86

Browse files
committed
[#2362893] Default disable cache.
1 parent 5517848 commit 04e4f86

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

components/resc-backend/src/resc_backend/resc_web_service/api.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def cache_key_builder(func, namespace: str = "", *, request=None, response=None,
163163
@app.on_event("startup")
164164
def app_startup():
165165
cache_enabled = f"{env_variables[RESC_REDIS_CACHE_ENABLE]}"
166-
if cache_enabled is True:
166+
cache_enabled = cache_enabled.lower() in ["true", 1]
167+
168+
if cache_enabled:
167169
host = f"{env_variables[RESC_REDIS_SERVICE_HOST]}"
168170
port = f"{env_variables[RESC_REDIS_PORT]}"
169171
password = f"{env_variables[REDIS_PASSWORD]}"
@@ -173,6 +175,9 @@ def app_startup():
173175
key_builder=cache_key_builder,
174176
enable=cache_enabled,
175177
)
178+
else:
179+
FastAPICache.init(backend=None, enable=cache_enabled)
180+
176181
try:
177182
_ = Session(bind=engine)
178183
check_db_initialized()

components/resc-backend/src/resc_backend/resc_web_service/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
EnvironmentVariable(
1313
RESC_REDIS_CACHE_ENABLE,
1414
"The REDIS authentication secret.",
15-
required=True,
15+
default=False,
1616
)
1717
]
1818

0 commit comments

Comments
 (0)