Learn the basics of Edge KV: create a namespace, read and write key-value data, and integrate with the Edge Routine API.
Limitations
Item | Description |
Storage space |
|
Key-value |
|
Synchronization time | Edge KV guarantees eventual consistency. Data typically syncs to all points of presence (POPs) within seconds, guaranteed within 300 seconds. |
Access limit | Edge Routines can only access Edge KV data within the same Alibaba Cloud account. Cross-account access is not supported. |
Use Edge KV
After enabling Edge KV, manage data through the ESA (Edge Security Acceleration) console or the Edge Routine API.
Create a namespace
Namespaces are isolated. You can create up to 10 namespaces.
Log on to the ESA console, and in the navigation pane on the left, choose .
Click Create Namespace, and enter the Namespace Name and Description.
NoteThe Namespace Name corresponds to the namespace parameter in the Edge Routine built-in API.

Click OK.
Manage data
Console
The ESA console supports values up to 100 KB. For larger values, use the Edge Routine API.
Use the ESA console to add, modify, or delete Edge KV data.
Log on to the ESA console, and in the navigation pane on the left, choose .
In the namespace list, find the target namespace and click Manage in the Actions column.
Click Add Key-Value Pair, and enter the Key and Value.

Click OK.
(Optional) After adding data, click Modify, View, or Delete to manage it.
API
Use the Edge Routine built-in API to add, modify, query, or delete Edge KV data.
Create a namespace in the ESA console before using the API. Edge KV API.
Call the Constructor and pass the namespace parameter to create a key-value object.
Namespace Name is the namespace name you created in the console, shown in the namespace list.
const edgeKv = new EdgeKV({ namespace: "ns"});After creating the key-value object, call these built-in APIs.
API
Description
Reads data from a namespace.
Writes or updates key-value data in a namespace.
Deletes a key and its value from a namespace.