Parameters
Limits
- Single data item: max 200KB
- Total storage per Mini Program: max 10MB
Code Example
Related APIs
my.getStorage
Get stored data
my.setStorageSync
Store data synchronously
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Store data in local cache asynchronously.
| Property | Type | Required | Description |
|---|---|---|---|
| key | String | Yes | Storage key identifier |
| data | Object/String | Yes | Data to store |
| success | Function | No | Callback on success |
| fail | Function | No | Callback on failure |
| complete | Function | No | Callback that always executes |
my.setStorage({
key: 'userSettings',
data: { theme: 'dark', language: 'en' },
success: () => {
console.log('Data saved');
}
});