Updated on 2025-05-13 GMT+08:00

Creating an Expired Key Scan Task

Function

This API is used to create an expired key scan task.

The keyspace will be scanned to release the memory used by expired keys that were not released due to the lazy free mechanism.

This scan is on the master node of the instance and will affect instance performance. Perform this operation during off-peak hours.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/instances/{instance_id}/scan-expire-keys-task

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description:

Project ID. For details, see Obtaining a Project ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

instance_id

Yes

String

Parameter description:

Instance ID. It can be viewed on the instance details page on the DCS console.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

id

String

Parameter description:

Expired key scan ID.

Value range:

N/A

instance_id

String

Parameter description:

Instance ID.

Value range:

N/A

status

String

Parameter description:

Status of the expired key scan task.

Value range:

  • waiting: The task is to be processed.

  • running: The task is being processed.

  • success: The task is successful.

  • failed: The task fails.

scan_type

String

Parameter description:

Scan mode.

Value range:

  • manual: manual analysis.

  • auto: automatic analysis.

created_at

String

Parameter description:

Time when a scan task is created. The format is 2020-06-15T02:21:18.669Z.

Value range:

N/A

started_at

String

Parameter description:

Time when a scan task started. The format is 2020-06-15T02:21:18.669Z. (The value is null and is not returned when the scan task is being created.)

Value range:

N/A

finished_at

String

Parameter description:

Time when a scan task ended. The format is 2020-06-15T02:21:18.669Z. (The value is null and is not returned when the scan task is being created.)

Value range:

N/A

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error information.

Value range:

N/A

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error information.

Value range:

N/A

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error information.

Value range:

N/A

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error information.

Value range:

N/A

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error information.

Value range:

N/A

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A

Example Requests

POST https://{dcs_endpoint}/v2/a4d31cb6-3d72-4fdc-8ec9-6e3a41e47f71/instances/5560df16-cebf-4473-95c4-d1b573c16e79/scan-expire-keys-task

Example Responses

Status code: 200

Expired key scan task created successfully.

{
  "id" : "aa735b6f-3d70-44e3-9771-66c6fae7459a",
  "instance_id" : "5560df16-cebf-4473-95c4-d1b573c16e79",
  "status" : "waiting",
  "scan_type" : "manual",
  "created_at" : "2020-06-15T02:21:18.669Z"
}

Status code: 400

Invalid request.

{
  "error_code" : "DCS.4818",
  "error_msg" : "Do not support auto expire scan."
}

Status Codes

Status Code

Description

200

Expired key scan task created successfully.

400

Invalid request.

401

Invalid authentication information.

403

Request rejected.

404

The requested resource could not be found.

500

Internal service error.

Error Codes

See Error Codes.