详情介绍:https://yq.aliyun.com/articles/291229
KV就是一个小型的以key-value方式存储的存储模块,它是把数据存储在FLASH上面,可以断电保存, kv对外提供了4个接口 。
- aos_kv_set
- aos_kv_get
- aos_kv_del
- aos_kv_del_by_prefix
实例:
static void write_kv(void)
{
char key[10] = "test";
char value[10] = "test_value";
int len = 10;
printf(">>>aos_kv_set:%d\r\n", aos_kv_set(key, value, len, 1));
}
static void read_kv(void)
{
char key[10] = {0};
char value[10] = {0};
int len = 10;
printf(">>>>aos_kv_get:%d\r\n", aos_kv_get("test", value, len));
printf("aos_kv_get>>>>%s\r\n", value);
}