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 cacheDir
  • cacheEnabled Boolean Whether or not cache asset into user's storage space, this property only works on mini-game platforms
  • autoClear Boolean Whether or not auto clear cache when storage ran out, this property only works on mini-game platforms
  • cacheInterval Number The interval between caching resources, this property only works on mini-game platforms, unit: ms
  • deleteInterval Number The interval between deleting resources, when you use cleanLRU, the resources will be deleted as this interval, unit: ms
  • cachedFiles Cache List of all cached files
Methods
  • getCache Get cached path with origin url
  • getTemp Get temporary path with origin url, this method only works on mini-game platforms
  • clearCache Clear all caches, please use with caution, If necessary, we recommend using it before the game is launched
  • clearLRU Clear part of caches with LRU strategy
  • removeCache 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
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
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

results matching ""

    No results matching ""