> 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.

# lynx: setSessionStorageItem() static method

APISummary
`lynx.setSessionStorageItem` 方法用于设置当前 WhiteBoard 中的缓存数据。只有共享该 WhiteBoard 的 LynxView 才能访问相同的数据。可以调用 [lynx.getSessionStorageItem](/next/zh/api/lynx-api/lynx/lynx-get-session-storage.md) 获取数据。

共享范围、原生配置和生命周期管理详见 [跨 LynxView 共享数据](/next/zh/guide/share-data-across-lynxviews.md)。

## 语法

```ts
setSessionStorageItem(key: string, value: object): void;
```

### 参数

#### key

设置缓存数据的 key，后续可通过该 key 来获取缓存数据以及监听数据变化。

#### value

需要存储的数据对象。

### 返回值

无（`undefined`）。

## 兼容性

**Compatibility Table**

**Query:** `lynx-api.lynx.setSessionStorageItem`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/lynx/setSessionStorageItem.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| setSessionStorageItem | Yes (2.9) | Yes (3.8) | Yes (2.9) | Yes (3.5) | Yes (3.5) | No |

**`setSessionStorageItem`**

The `lynx.setSessionStorageItem` method is used to set data shared across multiple LynxViews.

- **Web — Not supported:** The Web runtime does not implement the native session-storage bridge.

