缓存操作模块,提供sessionStorage和localStorage操作
- Source:
Members
(static, constant) LOCAL :Storage
- Source:
localStorage
Type:
- Storage
(static, constant) SESSION :Storage
- Source:
sessionStorage
Type:
- Storage
Methods
(static) clear(storageopt)
- Source:
删除全部缓存
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
storage |
Storage |
<optional> |
sessionStorage
|
存储方式 SESSION 或 LOCAL |
(static) get(key, storageopt) → {String|Object|Array}
- Source:
获取缓存
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | 缓存key |
||
storage |
Storage |
<optional> |
sessionStorage
|
存储方式 SESSION 或 LOCAL |
Returns:
- Type
- String | Object | Array
(static) remove(key, storageopt)
- Source:
删除缓存
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | 缓存key |
||
storage |
Storage |
<optional> |
sessionStorage
|
存储方式 SESSION 或 LOCAL |
(static) save(key, value, storageopt)
- Source:
保存缓存
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | 缓存key |
||
value |
String | Object | Array | 缓存值,对象、数组类型自动JSON.stringify成字符串 |
||
storage |
Storage |
<optional> |
sessionStorage
|
存储方式 SESSION 或 LOCAL |