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
cacheDirStringThe name of cacheDircacheEnabledBooleanWhether or not cache asset into user's storage space, this property only works on mini-game platformsautoClearBooleanWhether or not auto clear cache when storage ran out, this property only works on mini-game platformscacheIntervalNumberThe interval between caching resources, this property only works on mini-game platforms, unit: msdeleteIntervalNumberThe interval between deleting resources, when you usecleanLRU, the resources will be deleted as this interval, unit: mscachedFilesCacheList of all cached files
Methods
getCacheGet cached path with origin urlgetTempGet temporary path with origin url, this method only works on mini-game platformsclearCacheClear all caches, please use with caution, If necessary, we recommend using it before the game is launchedclearLRUClear part of caches with LRU strategyremoveCacheRemove 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
originUrlstring
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
originUrlstring
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
originUrlstring