> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# StoreValue

> 將項目新增至快取。

將項目新增至快取。

## 語法

```cpp theme={null}
HRESULT StoreValue(
    const void  pKey,
    UINT KeySize,
    const void  pValue,
    UINT ValueSize
)
```

### 參數

*pKey*\
類型：const void \*

要新增之項目的索引鍵。

*KeySize*\
類型：UINT

索引鍵的大小 (以位元組為單位)。

*pValue*\
類型：const void \*

指向記憶體區塊的指標，該區塊包含要新增的項目。

*ValueSize*\
類型：UINT

要新增之項目的大小 (以位元組為單位)。

### 傳回值

類型：HRESULT

如果函式成功，會傳回 **S\_OK**。否則，會傳回 [**HRESULT**](https://learn.microsoft.com/en-us/windows/desktop/com/structure-of-com-error-codes) [錯誤碼](https://learn.microsoft.com/en-us/windows/win32/com/com-error-codes-10)。

| 傳回值 | 描述 |
| - | - |
| DXGI\_ERROR\_ALREADY\_EXISTS | 已有具有相同索引鍵的項目。 |
| DXGI\_ERROR\_CACHE\_HASH\_COLLISION | 有一個項目的雜湊與所提供的索引鍵相同，但索引鍵不相符。 |
| DXGI\_ERROR\_CACHE\_FULL | 新增此項目會導致快取超過其大小上限。 |

## 備註

## 需求

**標頭:** d3d12\_xs.h 或 d3d12\_x.h\
**程式庫:** d3d12\_xs.lib 或 d3d12\_x.lib\
**支援的平台**: XBOX Series 主機與 XBOX One 系列

## 另請參閱

* [D3D12 著色器快取 API](https://microsoft.github.io/DirectX-Specs/d3d/ShaderCache.html)


## Related topics

- [Set Store Items](/api-reference/title-wide-data-management/set-store-items.md)
- [Update Store Items](/api-reference/title-wide-data-management/update-store-items.md)
- [市集整合 - Microsoft Store](/zh-TW/services/playfab/economy-monetization/economy-v2/marketplace/marketplace-integrations/microsoft.md)
- [Set Title Data](/api-reference/title-wide-data-management/set-title-data.md)
- [設定遊戲資料](/zh-TW/services/playfab/api-references/rest/server/title-wide-data-management/set-title-data.md)
