MCPcopy Index your code
hub / github.com/idank/explainshell / get_store

Function get_store

explainshell/web/__init__.py:15–33  ·  view source on GitHub ↗

Return the serving Store for the current Flask app. Production keeps one read-only CachingStore per worker process. Debug/dev keeps the old per-request Store behavior so DB rebuilds do not leave stale positive or negative lookup cache entries behind.

()

Source from the content-addressed store, hash-verified

13
14
15def get_store() -> store.Store:
16 """Return the serving Store for the current Flask app.
17
18 Production keeps one read-only CachingStore per worker process. Debug/dev
19 keeps the old per-request Store behavior so DB rebuilds do not leave stale
20 positive or negative lookup cache entries behind.
21 """
22 if STORE_EXTENSION_KEY not in current_app.extensions:
23 if current_app.config["DEBUG"]:
24 if "store" not in g:
25 g.store = store.Store(current_app.config["DB_PATH"], read_only=True)
26 return g.store
27
28 with _STORE_CREATE_LOCK:
29 if STORE_EXTENSION_KEY not in current_app.extensions:
30 current_app.extensions[STORE_EXTENSION_KEY] = CachingStore(
31 current_app.config["DB_PATH"]
32 )
33 return current_app.extensions[STORE_EXTENSION_KEY]
34
35
36def _get_git_sha(project_root: str) -> str:

Calls 1

CachingStoreClass · 0.90