Store or update an item.
put_item(
self,
namespace: Sequence[str],
,
key: str,
value: Mapping[str, Any],
index: Literal[False] | list[str] | None = None,
ttl: int | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None
) -> Noneclient = get_client(url="http://localhost:2024")
await client.store.put_item(
["documents", "user123"],
key="item456",
value={"title": "My Document", "content": "Hello World"}
)| Name | Type | Description |
|---|---|---|
namespace* | Sequence[str] | A list of strings representing the namespace path. |
key* | str | The unique identifier for the item within the namespace. |
value* | Mapping[str, Any] | A dictionary containing the item's data. |
index | Literal[False] | list[str] | None | Default: NoneControls search indexing - None (use defaults), False (disable), or list of field paths to index. |
ttl | int | None | Default: NoneOptional time-to-live in minutes for the item, or None for no expiration. |
headers | Mapping[str, str] | None | Default: NoneOptional custom headers to include with the request. |
params | QueryParamTypes | None | Default: NoneOptional query parameters to include with the request. |