- tensorstore.KvStore.__setitem__(self, key: str, value: str | None)
Synchronously writes the value of a single key.
Example
>>> store = ts.KvStore.open({'driver': 'memory'}).result() >>> store[b'a'] = b'value' >>> store[b'a'] b'value' >>> store[b'b'] Traceback (most recent call last): ... KeyError... >>> store[b'a'] = None >>> store[b'a'] Traceback (most recent call last): ... KeyError...
Note
If no
transaction
is specified, the current thread is blocked until the write completes and durability is guaranteed (to the extent supported by the driver).If a
transaction
is specified, the current thread is blocked until the write is recorded in the transaction. The actual write operation is not performed until the transaction is committed.
Computations in other threads may continue even while the current thread is blocked.
See also