# Data Storage > ![icon-note.gif](public_sys-resources/icon-note.gif) **Noteļ¼š** > - The APIs of this module are no longer maintained since API version 6. It is recommended that you use [`@ohos.data.storage`](js-apis-data-storage.md) instead. > > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import ``` import storage from '@system.storage'; ``` ## storage.get get(Object): void Reads the stored content. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | | key | string | Yes | Content index. | | default | string | No | Default value returned when the **key** does not exist. | | success | Function | No | Called when the stored content is successfully read. | | fail | Function | No | Called when the stored content fails to be read. | | complete | Function | No | Called when the execution is complete. | **Example** ``` export default { storageGet() { storage.get({ key: 'storage_key', success: function(data) { console.log('call storage.get success: ' + data); }, fail: function(data, code) { console.log('call storage.get fail, code: ' + code + ', data: ' + data); }, complete: function() { console.log('call complete'); }, }); } } ``` ## storage.set set(Object): void Modifies the stored content. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | | key | string | Yes | Index of the stored content to be modified. | | value | string | No | Target storage content. The maximum number of characters allowed is 128. | | success | Function | No | Called when the stored content is modified successfully. | | fail | Function | No | Called when the stored content fails to be modified. | | complete | Function | No | Called when the execution is complete. | **Example** ``` export default { storageSet() { storage.set({ key: 'storage_key', value: 'storage value', success: function() { console.log('call storage.set success.'); }, fail: function(data, code) { console.log('call storage.set fail, code: ' + code + ', data: ' + data); }, }); } } ``` ## storage.clear clear(Object): void Clears the stored content. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | | success | Function | No | Called when the stored content is cleared successfully | | fail | Function | No | Called when the stored content fails to be cleared | | complete | Function | No | Called when the execution is complete | **Example** ``` export default { storageClear() { storage.clear({ success: function() { console.log('call storage.clear success.'); }, fail: function(data, code) { console.log('call storage.clear fail, code: ' + code + ', data: ' + data); }, }); } } ``` ## storage.delete delete(Object): void Deletes the stored content. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | | key | string | Yes | Content index. | | success | Function | No | Called when the stored content is deleted successfully. | | fail | Function | No | Called when the stored content fails to be deleted. | | complete | Function | No | Called when the execution is complete. | **Example** ``` export default { storageDelete() { storage.delete({ key: 'Storage1', success: function() { console.log('call storage.delete success.'); }, fail: function(data, code) { console.log('call storage.delete fail, code: ' + code + ', data: ' + data); }, }); } } ```