Creating an Expired Key Scan Task

Function

This API is used to create an expired key scan task. Redis 3.0 does not support expired key scan. 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.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Minimum: 0

Maximum: 36

instance_id

Yes

String

Instance ID.

Minimum: 0

Maximum: 36

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

id

String

Expired key scan ID.

Minimum: 0

Maximum: 36

instance_id

String

Instance ID.

Minimum: 0

Maximum: 36

status

String

Scan task status.

Enumeration values:

  • waiting

  • running

  • success

  • failed

scan_type

String

Scan mode.

Enumeration values:

  • manual

  • auto

created_at

String

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

started_at

String

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

finished_at

String

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

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

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

Maximum: 1024

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

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

Maximum: 1024

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

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

Maximum: 1024

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

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

Maximum: 1024

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

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

Maximum: 1024

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.