> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# Interface: QueryDataStorage

宿主提供的同步持久化接口；写入必须原子替换作用域数据，否则抛错。

## Methods

### read()

> **read**(`scope`: `string`): `Readonly`\<`Record`\<`string`, `unknown`>> | `null`

读取指定作用域已保存的 Query 结果；尚未保存时返回 null。

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `scope`   | `string` |

#### Returns

`Readonly`\<`Record`\<`string`, `unknown`>> | `null`

***

### write()

> **write**(`scope`: `string`, `data`: [`InitialQueryResults`](/next/zh/api/genui/openui/core/type-aliases/InitialQueryResults.md)): `void`

持久化指定作用域的完整快照，失败时抛错。

#### Parameters

| Parameter | Type                                                                                        |
| --------- | ------------------------------------------------------------------------------------------- |
| `scope`   | `string`                                                                                    |
| `data`    | [`InitialQueryResults`](/next/zh/api/genui/openui/core/type-aliases/InitialQueryResults.md) |

#### Returns

`void`
