MCPcopy Create free account
hub / github.com/Freedium-cfd/web / pull

Method pull

database-lib/database_lib/main.py:174–185  ·  view source on GitHub ↗
(self, key: str)

Source from the content-addressed store, hash-verified

172 # self.cursor.execute("CREATE INDEX IF NOT EXISTS idx_key ON cache (key)")
173
174 def pull(self, key: str) -> Union[CacheResponse, None]:
175 self.ensure_connection()
176 with self.connection:
177 cache = self.cursor.execute(
178 "SELECT value FROM cache WHERE key = :0", {"0": key}
179 ).fetchone()
180 if cache:
181 logger.debug("Value found in DB, returning it")
182 return CacheResponse(key, cache[0])
183 else:
184 logger.debug(f"No value found for key: {key}")
185 return None
186
187 def push(self, key: str, value: Union[str, dict]) -> None:
188 if isinstance(value, dict):

Callers 3

test_push_and_pullMethod · 0.45
test_deleteMethod · 0.45
_get_from_cacheMethod · 0.45

Calls 2

ensure_connectionMethod · 0.95
CacheResponseClass · 0.85

Tested by 2

test_push_and_pullMethod · 0.36
test_deleteMethod · 0.36