Help Center/ GeminiDB/ API Reference/ APIs v3 (Recommended)/ Instances/ Creating a Memory Acceleration Rule
Updated on 2025-12-04 GMT+08:00

Creating a Memory Acceleration Rule

Function

This API is used to create a memory acceleration rule.

Constraints

This API can be used only on primary/standby GeminiDB Redis instances.

Authorization Information

Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    gaussdbfornosql:instance:createDBCacheRule

    write

    -

    -

    nosql:instance:createDBCacheRule

    -

URI

POST /v3/{project_id}/dbcache/rule

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token

You can obtain the token by calling the IAM API by following Obtaining a User Token Through Password Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

dbcache_mapping_id

Yes

String

Definition

Memory acceleration mapping ID

Constraints

N/A

Range

N/A

Default Value

N/A

name

Yes

String

Definition

Name of a memory acceleration rule

Constraints

N/A

Range

The value can contain a maximum of 256 characters and must be unique in the current mapping.

Default Value

N/A

source_db_schema

Yes

String

Definition

Source database

Constraints

N/A

Range

N/A

Default Value

N/A

source_db_table

Yes

String

Definition

Source database table

Constraints

N/A

Range

N/A

Default Value

N/A

storage_type

Yes

String

Definition

Storage type of the destination database

Constraints

N/A

Range

hash

Default Value

N/A

target_database

Yes

String

Definition

Destination database

Constraints

N/A

Range

0999

Default Value

N/A

key_columns

Yes

Array of strings

Definition

Columns used by mapped keys

Constraints

N/A

Range

N/A

Default Value

N/A

value_columns

Yes

Array of strings

Definition

Columns used by mapped values

Constraints

N/A

Range

N/A

Default Value

N/A

ttl

No

String

Definition

Lifetime of a key (unit: ms)

Constraints

N/A

Range

N/A

Default Value

If this parameter is not transferred, default value 2592000000 is used, indicating 30 days.

key_separator

Yes

String

Definition

Key separator of a mapping

Constraints

N/A

Range

Only one character is allowed.

Default Value

N/A

value_separator

No

String

Definition

Value separator of a mapping

Constraints

Only one character is allowed.

Range

N/A

Default Value

N/A

key_prefix

Yes

String

Definition

Key prefix

Constraints

The value can contain no more than 1,024 characters. key_prefix and target_database must be unique in the current mapping.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Definition

ID of a memory acceleration rule

Range

N/A

Example Requests

Creating a memory acceleration rule

POST https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/dbcache/rule 
 
{ 
  "dbcache_mapping_id" : "e6f8526c-8b9c-4811-9218-4d2d7c1ddde1", 
  "name" : "mysql_a1-to-redis_01", 
  "source_db_schema" : "test", 
  "source_db_table" : "students_info_t", 
  "storage_type" : "hash", 
  "target_database" : "0", 
  "key_columns" : [ "sno", "sname" ], 
  "value_columns" : [ "sno", "sname", "age" ], 
  "ttl" : "-1", 
  "key_separator" : ":", 
  "key_prefix" : "prefix1" 
}

Example Responses

Status code: 200

Successful response

{ 
  "id" : "04efe8e2-9255-44ae-a98b-d87cae411890" 
}

Status Codes

See Status Codes.

Error Codes

See Status Codes.