Menghapus secara batch pasangan kunci-nilai dari namespace KV tertentu berdasarkan daftar nama kunci yang ditentukan. Ukuran badan permintaan maksimum adalah 100 MB.
Deskripsi operasi
Operasi ini menyediakan fungsionalitas yang sama dengan BatchDeleteKv, tetapi mengizinkan badan permintaan yang lebih besar. Jika badan permintaan kecil, gunakan operasi BatchDeleteKv untuk mengurangi waktu proses di sisi server. Operasi ini harus dipanggil dengan menggunakan SDK. Misalnya, saat menggunakan SDK Golang, panggil fungsi BatchDeleteKvWithHighCapacityAdvance.
func TestBatchDeleteWithHighCapacity() error {
// Inisialisasi konfigurasi
cfg := new(openapi.Config)
cfg.SetAccessKeyId("xxxxxxxxx")
cfg.SetAccessKeySecret("xxxxxxxxxx")
cli, err := NewClient(cfg)
if err != nil {
return err
}
runtime := &util.RuntimeOptions{}.
// Buat permintaan Hapus batch untuk pasangan kunci-nilai
namespace := "test_batch_put"
rawReq := BatchDeleteKvRequest{
Namespace: &namespace,
}
for i := 0; i < 10000; i++ {
key := fmt.Sprintf("test_key_%d", i)
rawReq.Keys = append(rawReq.Keys, &key)
}
payload, err := json.Marshal(rawReq)
if err != nil {
return err
}.
// Jika muatan lebih besar dari 2 MB, panggil operasi berkapasitas tinggi untuk Hapus pasangan kunci-nilai
reqHighCapacity := BatchDeleteKvWithHighCapacityAdvanceRequest{
Namespace: &namespace,
UrlObject: bytes.NewReader(payload),
}
resp, err := cli.BatchDeleteKvWithHighCapacityAdvance(&reqHighCapacity, runtime)
if err != nil {
return err
}
return nil
}.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Namespace |
string |
Yes |
Nama namespace yang ditentukan saat Anda memanggil CreateKvNamespace. |
test_namespace |
| Url |
string |
Yes |
URL unduhan yang berisi pasangan kunci-nilai yang akan dihapus secara batch, seperti URL unduhan OSS dengan izin baca.
|
https://xxxobject.oss-cn-region.aliyuncs.com/9d91_xxxxxxxxxxx_158bb6e0f97c477791209bb46bd599f7 |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
Skema Respons. |
||
| RequestId |
string |
ID permintaan. |
EEEBE525-F576-1196-8DAF-2D70CA3F4D2F |
| FailKeys |
array |
Daftar kunci yang gagal dihapus. |
|
|
string |
Nama kunci yang gagal dihapus. |
test_key1 |
|
| SuccessKeys |
array |
Daftar kunci yang berhasil dihapus. |
|
|
string |
Nama kunci yang berhasil dihapus. |
test_key1 |
Contoh
Respons sukses
JSONformat
{
"RequestId": "EEEBE525-F576-1196-8DAF-2D70CA3F4D2F",
"FailKeys": [
"test_key1"
],
"SuccessKeys": [
"test_key1"
]
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidAccount.Malformed | The specified account is invalid. | The account input is invalid, for example, the input is empty. |
| 400 | InvalidNameSpace.Malformed | The specified namespace is invalid. | The namespace name input is invalid, for example, the input is an empty string. |
| 400 | InvalidKey.Malformed | The specified key is invalid. | The key name input is invalid, for example, the input is an empty string. |
| 400 | InvalidKey.ExceedsMaximum | The size of the key cannot exceed 512 bytes. | The length of the requested key is too large. |
| 400 | InvalidValue.ExceedsMaximum | The size of the value cannot exceed 2,000,000 bytes. | The stored value is too large. |
| 403 | InvalidKey.ExceedsCapacity | The maximum capacity of a single namespace cannot exceed 1 GB. | The capacity of the namespace exceeds the limit. |
| 403 | Unauthorized.InvalidParameters | The specified authentication parameters are invalid. | The authentication parameter input is invalid. |
| 403 | Unauthorized.InvalidTime | The specified authentication time is invalid. | The authentication time parameter you entered is invalid. Check the parameter value and try again. |
| 403 | Unauthorized.InvalidToken | Token authentication failed. | The token you entered is invalid. Check and enter the correct token, and then try again. |
| 404 | InvalidAccount.NotFound | The specified account does not exist. | The specified account does not exist. |
| 404 | InvalidNameSpace.NotFound | The specified namespace does not exist. | The specified namespace does not exist. |
| 404 | InvalidKey.NotFound | The specified key does not exist. | The specified key-value pair does not exist. |
| 406 | InvalidNameSpace.Duplicate | The specified namespace already exists. | The specified namespace already exists. |
| 406 | InvalidNameSpace.QuotaFull | The maximum number of namespaces is exceeded. | The number of namespaces exceeds the capacity limit. |
| 429 | TooManyRequests | Too many requests are submitted. | Requests are submitted too frequently. Please try again later. |
| 429 | TooQuickRequests | Request for putting or deleting keys are frequently submitted. | Modification or deletion operations on key-value pairs are too frequent. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.