CacheManager
Class
Module: cc.AssetManager
Cache manager is a module which controls all caches downloaded from server in non-web platform, it is a singleton
All member can be accessed with cc.assetManager.cacheManager
.
Index
Properties
cacheDir
String
The name of cacheDircacheEnabled
Boolean
Whether or not cache asset into user's storage space, this property only works on mini-game platformsautoClear
Boolean
Whether or not auto clear cache when storage ran out, this property only works on mini-game platformscacheInterval
Number
The interval between caching resources, this property only works on mini-game platforms, unit: msdeleteInterval
Number
The interval between deleting resources, when you usecleanLRU
, the resources will be deleted as this interval, unit: mscachedFiles
Cache
List of all cached files
Methods
getCache
Get cached path with origin urlgetTemp
Get temporary path with origin url, this method only works on mini-game platformsclearCache
Clear all caches, please use with caution, If necessary, we recommend using it before the game is launchedclearLRU
Clear part of caches with LRU strategyremoveCache
Remove cache with origin url
Details
Properties
cacheDir
The name of cacheDir
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:20 |
cacheEnabled
Whether or not cache asset into user's storage space, this property only works on mini-game platforms
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:33 |
autoClear
Whether or not auto clear cache when storage ran out, this property only works on mini-game platforms
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:46 |
cacheInterval
The interval between caching resources, this property only works on mini-game platforms, unit: ms
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:59 |
deleteInterval
The interval between deleting resources, when you use
cleanLRU
, the resources will be deleted as this interval, unit: ms
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:72 |
cachedFiles
List of all cached files
meta | description |
---|---|
Type | Cache |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:85 |
Methods
getCache
Get cached path with origin url
meta | description |
---|---|
Returns | String |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:99 |
Parameters
originUrl
string
getTemp
Get temporary path with origin url, this method only works on mini-game platforms
meta | description |
---|---|
Returns | String |
Defined in | cocos2d/core/asset-manager/cache-manager.ts:112 |
Parameters
originUrl
string
clearCache
Clear all caches, please use with caution, If necessary, we recommend using it before the game is launched
meta | description |
---|---|
Defined in | cocos2d/core/asset-manager/cache-manager.ts:125 |
clearLRU
Clear part of caches with LRU strategy
meta | description |
---|---|
Defined in | cocos2d/core/asset-manager/cache-manager.ts:136 |
removeCache
Remove cache with origin url
meta | description |
---|---|
Defined in | cocos2d/core/asset-manager/cache-manager.ts:147 |
Parameters
originUrl
string