Set a value in state.
(self, key: str, value: Any)
| 159 | return row["value"] if row else default |
| 160 | |
| 161 | def set(self, key: str, value: Any): |
| 162 | """Set a value in state.""" |
| 163 | with self._lock: |
| 164 | self._conn.execute( |
| 165 | "INSERT OR REPLACE INTO state (key, value, updated_at) VALUES (?, ?, ?)", |
| 166 | (key, str(value), int(time.time())), |
| 167 | ) |
| 168 | self._conn.commit() |
| 169 | |
| 170 | def delete(self, key: str) -> bool: |
| 171 | """Delete a key from state. Returns True if deleted, False if not found.""" |
no test coverage detected