M3D / M3D / Utility / CacheHelper
Class: CacheHelper
File
Brief
缓存帮助类
Author
yw
Date
2022-1-17
Version
1.0
Copyright
All Rights Reserved. Copyright (C) 2022 HOTEAMSOFT, Ltd
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new CacheHelper(): CacheHelper
Returns
Properties
dbName
▪ Static
dbName: string
idKeyPath
▪ Static
idKeyPath: string
subDbName
▪ Static
subDbName: string
urlKeyPath
▪ Static
urlKeyPath: string
Methods
cacheFile
▸ cacheFile(url
, data
, isSubFile?
): void
Parameters
Name | Type |
---|---|
url | string |
data | any |
isSubFile? | boolean |
Returns
void
checkIndexDB
▸ checkIndexDB(): IDBFactory
获取IDBFactory, 如果为空,则判断不支持indexeddb
Returns
IDBFactory
[description]
Create Time
2023-1-12 T15:44:36+0800
Version
1.0
clearCache
▸ clearCache(): boolean
Returns
boolean
Description
清除缓存
createObjectStoreIndexs
▸ createObjectStoreIndexs(db
, dbName
, keyPath
, indexs
): void
创建索引
Parameters
Name | Type | Description |
---|---|---|
db | IDBDatabase | [description] |
dbName | string | - |
keyPath | string | [description] |
indexs | any | [description] |
Returns
void
Create Time
2019-12-06T15:59:16+0800
Version
1.0
getCache
▸ getCache(url
, isSubFile?
): Promise
<string
| Object
| ArrayBuffer
>
根据URL和数据类型获取缓存
Parameters
Name | Type | Description |
---|---|---|
url | string | [description] |
isSubFile? | boolean | - |
Returns
Promise
<string
| Object
| ArrayBuffer
>
[description]
Create Time
2019-11-08T17:04:04+0800
Version
1.0
openDB
▸ openDB(dbName
, version
): Promise
<IDBDatabase
>
根据名称和版本号打开数据库
Parameters
Name | Type | Description |
---|---|---|
dbName | string | [description] |
version | number | [description] |
Returns
Promise
<IDBDatabase
>
Create Time
2019-12-06T14:09:36+0800
Version
1.0