---
title: CacheKeyByIdAndIndex
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/hixlug/llmprv2_42_0057.html
sourcePath: /source/zh/canncommercial/900/API/hixlug/llmprv2_42_0057.html
indexId: 3cfba5d0e9065cd971a8bf98737a9609e31515688f88644638b8a6cd0a5699a361
---
# CacheKeyByIdAndIndex

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | x |
| Atlas 推理系列产品 | x |
| Atlas 训练系列产品 | x |


说明：针对 Atlas A2 训练系列产品 / Atlas A2 推理系列产品 ，仅支持Atlas 800I A2 推理服务器、A200I A2 Box 异构组件。


#### 函数功能

构造CacheKeyByIdAndIndex，通常在CacheManager的pull_cache、push_cache接口中作为参数类型使用。


#### 函数原型

```
__init__(cluster_id: int, cache_id: int, batch_index: int = 0)
```


#### 参数说明

| 参数名称 | 数据类型 | 取值说明 |
| --- | --- | --- |
| cluster\_id | int | cache所在节点的集群id。 |
| cache\_id | int | cache关联的cache id。 |
| batch\_index | int | cache的batch\_index。 |


#### 调用示例

```
from llm_datadist import CacheKeyByIdAndIndex
cache_key = CacheKeyByIdAndIndex(0, 1, 0)
```


#### 返回值

正常情况下返回CacheKeyByIdAndIndex的实例。

传入数据类型错误情况下会抛出TypeError或ValueError异常。


#### 约束说明

无
