Retrieve multiple memory units by their IDs in a single query.
(self, memory_ids: list[str])
| 1309 | return self._row_to_unit(row) |
| 1310 | |
| 1311 | def get_by_ids(self, memory_ids: list[str]) -> list[MemoryUnit]: |
| 1312 | """Retrieve multiple memory units by their IDs in a single query.""" |
| 1313 | if not memory_ids: |
| 1314 | return [] |
| 1315 | placeholders = ",".join("?" for _ in memory_ids) |
| 1316 | rows = self.conn.execute( |
| 1317 | f"SELECT * FROM memories WHERE memory_id IN ({placeholders})", |
| 1318 | memory_ids, |
| 1319 | ).fetchall() |
| 1320 | return [self._row_to_unit(r) for r in rows] |
| 1321 | |
| 1322 | def garbage_collect(self, scope_id: str) -> dict: |
| 1323 | """Remove orphaned superseded memories and return cleanup stats.""" |