提交 e2189e92 编写于 作者: A Annie_wang
上级 011e3de2
...@@ -35,7 +35,6 @@ The following table lists the APIs used for KV data persistence. Most of the API ...@@ -35,7 +35,6 @@ The following table lists the APIs used for KV data persistence. Most of the API
1. Create a **KvManager** instance to manage database objects. 1. Create a **KvManager** instance to manage database objects.
Example: Example:
Stage model: Stage model:
...@@ -95,12 +94,11 @@ The following table lists the APIs used for KV data persistence. Most of the API ...@@ -95,12 +94,11 @@ The following table lists the APIs used for KV data persistence. Most of the API
2. Create and obtain a KV store. 2. Create and obtain a KV store.
Example: Example:
```js ```js
try { try {
const options = { const options = {
createIfMissing: true, // Whether to create a KV store when the database file does not exist. By default, a KV store is created. createIfMissing: true, // Whether to create a KV store when the database file does not exist. By default, a KV store is created.
createIfMissing: true, // Whether to encrypt database files. By default, database files are not encrypted. encrypt: false, // Whether to encrypt the KV store. By default, KV stores are not encrypted.
backup: false, // Whether to back up database files. By default, the database files are backed up. backup: false, // Whether to back up database files. By default, the database files are backed up.
autoSync: true, // Whether to automatically synchronize database files. The value **true** means to automatically synchronize database files; the value **false** (default) means the opposite. autoSync: true, // Whether to automatically synchronize database files. The value **true** means to automatically synchronize database files; the value **false** (default) means the opposite.
kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION, // Type of the KV store to create. By default, a device KV store is created. kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION, // Type of the KV store to create. By default, a device KV store is created.
...@@ -123,7 +121,6 @@ The following table lists the APIs used for KV data persistence. Most of the API ...@@ -123,7 +121,6 @@ The following table lists the APIs used for KV data persistence. Most of the API
3. Use **put()** to add data to the KV store. 3. Use **put()** to add data to the KV store.
Example: Example:
```js ```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value_test_string';
...@@ -147,7 +144,6 @@ The following table lists the APIs used for KV data persistence. Most of the API ...@@ -147,7 +144,6 @@ The following table lists the APIs used for KV data persistence. Most of the API
4. Use **get()** to obtain the value of a key. 4. Use **get()** to obtain the value of a key.
Example: Example:
```js ```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value_test_string';
...@@ -174,7 +170,6 @@ The following table lists the APIs used for KV data persistence. Most of the API ...@@ -174,7 +170,6 @@ The following table lists the APIs used for KV data persistence. Most of the API
5. Use **delete()** to delete the data of the specified key. 5. Use **delete()** to delete the data of the specified key.
Example: Example:
```js ```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value_test_string';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册