This action will force synchronization from OpenHarmony/docs, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
Provides functions for obtaining, setting, and deleting a key-value pair.
Key-value pairs can be permanently stored in the file system. If FEATURE_KV_CACHE is enabled, key-value pairs can be stored in the cache. For details about cache specifications, see MAX_CACHE_SIZE. For details about the number of key-value pairs that can be stored in an application, see MAX_KV_SUM.
Since:
1.0
Version:
1.0
Provides functions for obtaining, setting, and deleting a key-value pair. |
UtilsGetValue (const char *key, char *value, unsigned int len) |
Obtains the value matching a specified key from the file system or cache. |
UtilsSetValue (const char *key, const char *value) |
Adds or updates the value matching a specified key in the file system or cache. |
UtilsDeleteValue (const char *key) |
Deletes the value matching a specified key from the file system or cache. |
ClearKVCache (void) |
int ClearKVCache (void )
Description:
Clears all key-value pairs from the cache.
Attention:
This function is available only if FEATURE_KV_CACHE is enabled.
Returns:
Returns 0 if the operation is successful; returns -1 otherwise.
int UtilsDeleteValue (const char * key)
Description:
Deletes the value matching a specified key from the file system or cache.
Parameters:
key | Indicates the key whose value is to be deleted. It allows only lowercase letters, digits, underscores (_), and dots (.). Its length cannot exceed 32 bytes (including the end-of-text character in the string). |
Returns:
Returns 0 if the operation is successful; returns -9 if a parameter is incorrect; returns -1 in other scenarios.
int UtilsGetValue (const char * key, char * value, unsigned int len )
Description:
Obtains the value matching a specified key from the file system or cache.
Parameters:
key | Indicates the key to be indexed. It allows only lowercase letters, digits, underscores (_), and dots (.). Its length cannot exceed 32 bytes (including the end-of-text character in the string). |
value | Indicates the buffer for storing the value that matches the key. This is an output parameter. |
len | Indicates the size of the value space in the buffer. |
Returns:
Returns the length of the value if the operation is successful; returns -9 if a parameter is incorrect; returns -1 in other scenarios; returns 0 if the value is obtained from the cache.
int UtilsSetValue (const char * key, const char * value )
Description:
Adds or updates the value matching a specified key in the file system or cache.
Parameters:
key | Indicates the key whose value is to be added or updated. It allows only lowercase letters, digits, underscores (_), and dots (.). Its length cannot exceed 32 bytes (including the end-of-text character in the string). |
value | Indicates the value to be added or updated. Its length cannot exceed 128 bytes (including the end-of-text character in the string). |
Returns:
Returns 0 if the operation is successful; returns -9 if a parameter is incorrect; returns -1 in other scenarios.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。