Usage
Device SupportGroup Support
Info
Current storage capacity sdk abstracts the following capabilities:
- key prefix: Automatically prefixes storage keys with dev id values to prevent data conflicts caused by storage on different devices of the same product.
- Data Auto-Synchronization: When developers manipulate custom data, it is automatically stored both locally (using getStorage/setStorage) and in the cloud (using getDevProperty/saveDevProperty), ensuring synchronization between the two. The system always returns the latest data, preventing data loss in weak network environments by ensuring local operations are synchronized with the cloud.
SmartStorageAbility(options?: DeviceId | object)
Requires:
@ray-js/panel-sdk≥1.0.0
Description
Smart storage capability that provides cloud-persistent, device-level key-value storage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| No | Storage capability initialization configuration |
Return Value
Type: SmartStorageAbility
SmartStorageAbility instance
Referenced Types
type
DeviceIdValid Values
options.storageType
| Value | Description | Since |
|---|---|---|
local | - | - |
cloud | - | - |
both | - | - |
Methods
| Method | Description |
|---|---|
| init | Initialize the storage capability and establish cloud and local storage channels |
| get | Read the stored data for the specified key |
| getAll | Read all stored data under the current device/group |
| set | Store data for the specified key |
| setAll | Batch store multiple key-value pairs |
| remove | Delete the stored data for the specified key |