Deletes the expired keys of an ApsaraDB for Redis instance.

For more information about how to clear the expired keys in the ApsaraDB for Redis console, see Clear data.

Note Expired keys cannot be recovered after they are deleted. Exercise caution when you call this operation.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes FlushExpireKeys

The operation that you want to perform. Set the value to FlushExpireKeys.

InstanceId String Yes r-bp1zxszhcgatnx****

The ID of the instance.

EffectiveTime String No Immediately

The time when the minor version is upgraded. Valid values:

  • Immediately: immediately deletes expired keys.
  • MaintainTime:deletes expired key in the maintenance window.
Note You can call the ModifyInstanceMaintainTime operation to modify the maintenance window of an ApsaraDB for Redis instance.
RegionId String No cn-hangzhou

The region ID of the instance.

Response parameters

Parameter Type Example Description
InstanceId String r-bp1zxszhcgatnx****

The ID of the instance.

RequestId String 82E30AB7-E3A4-46AC-88A0-3E4DCDC5****

The ID of the request.

TaskId String 21986****

The ID of the task.


Sample requests
&<Common request parameters>

Sample success responses

XML format


JSON format

	"InstanceId": "r-bp1zxszhcgatnx****",
	"RequestId": "82E30AB7-E3A4-46AC-88A0-3E4DCDC5****",
	"TaskId": "21986****"

Error codes

For a list of error codes, visit the API Error Center.