woc.tch
class
TCHashDB:
Object representing a TokyoCabinet Hash table
TCHashDB(path: str, ro: bool = False)
Create a new TokyoCabinet hash table object.
Parameters
- path: path to the database file
- ro: if True, open in lock-free read-only mode; if False, lock and open in write mode (create if not exists)
Raises
- OSError: if the database cannot be opened
def
get(self, key: bytes) -> bytes:
Get a record.
Raises
- KeyError: if the key is not found
- OSError: if the operation fails
def
put(self, key: bytes, value: bytes) -> None:
Upsert a record.
Raises
- OSError: if the operation fails