This topic describes the basic operations of core features that provided by Edge KV. It guides you to quickly create namespaces, read and write data, and integrate APIs by providing simplified instructions, code examples, and key considerations.
Before you begin
Before you use Edge KV, take note of the following items:
Storage space
An Alibaba Cloud account can have up to 10 GB of storage space.
A namespace can have up to 1 GB of storage space.
Key-Value
A key can be up to 512 bytes in length and can contain only letters, digits, hyphens (-), and underscores (_). It cannot contain special characters, such as spaces, forward slashes (/), and question marks (?).
A value can be up to 1.8 MB in size.
NoteEach key-value pair belongs to a namespace.
Synchronization time
To ensure data consistency, data is synchronized to points of presence (POPs) around the world within 20 seconds, though it may take up to 300 seconds in rare cases.
Access limit
Edge Routine can read and write only Edge KV data that belongs to the same Alibaba Cloud account. For example, Edge Routine of Account A cannot read and write Edge KV data of Account B.
Use Edge KV
After you activate Edge KV, you can use Edge KV in the Edge Security Acceleration (ESA) console or by performing the built-in API operations of Edge Routine.
Create a namespace
Namespaces are isolated from each other. You can create up to 10 namespaces.
Log on to the ESA console, and in the left-side navigation pane, choose .
On the page that appears, click Create Namespace. In the dialog that appears, follow the on-screen instructions to specify the Namespace Name and Description parameters.
NoteThe Namespace Name parameter corresponds to the namespace parameter in the built-in API operations of Edge Routine.
Click OK.
Manage Edge KV data
Manage Edge KV data by using the ESA console
You can add a value of up to 100 KB in size in the ESA console. To add a value of a larger size, call an API operation of an Edge routine.
You can add, modify, or delete Edge KV data in the ESA console.
Log on to the ESA console, and in the left-side navigation pane, choose .
In the namespace list, find the namespace that you want to manage and click Manage in the Actions column.
Click Add Key-value Pair and follow the on-screen instructions to specify the Key and Value parameters.
Click OK.
Optional. After you add data, click Modify, View, or Delete to manage the data.
Manage Edge KV data by performing API operations
You can perform the built-in API operations of Edge Routine to add, modify, query, or delete Edge KV data.
Before you perform API operations to manage data, make sure that a namespace is created in the ESA console.
For more information about API operations, see Edge KV API operations.
Perform the Constructor operation to pass the namespace parameter to create a key-value object.
The value of the namespace parameter is the name of the namespace that you created in the ESA console. You can view the namespace in the namespace list.
const edgeKv = new EdgeKV({ namespace: "ns"});
After you create a key-value object, perform the following built-in API operations to implement the related features.