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

- [市场集成 - Microsoft Store](/zh-CN/services/playfab/economy-monetization/economy-v2/marketplace/marketplace-integrations/microsoft.md)
- [搜索](/zh-CN/services/playfab/economy-monetization/economy-v2/catalog/search.md)
- [XStore](/zh-CN/reference/system/xstore/xstore_members.md)
- [GetPMCValue](/zh-CN/reference/tools/pix3/functions/getpmcvalue.md)
- [PFStatisticValue](/zh-CN/services/playfab/api-references/c/pftypes/structs/pfstatisticvalue.md)
